From 9524c066107bd0a55f4247b8048e00a0cfa5bf2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Feb 2024 14:13:21 +0100 Subject: [PATCH 01/13] Update NuGet versions to pre-release. --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index 8d09b8d..f22e9b4 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index f3671dd..bdc7572 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + + From 77cb14b466a23be2d4de15d641efa9488033d357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Mon, 4 Mar 2024 00:22:21 +0100 Subject: [PATCH 02/13] Update OC to latest (because of bug fix for WorkflowTypeStep) --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index f22e9b4..5925dde 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index cc724f9..34b8ae2 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + + From 7fd0c17be215fe46d5373ff6d37589f8d46f57ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 8 Mar 2024 00:09:22 +0100 Subject: [PATCH 03/13] Update OC preview version. --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index 5925dde..e27aebb 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index 34b8ae2..a839cd8 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + + From 2d7810dd07d9b4964409064255d36dd89344b548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Wed, 13 Mar 2024 06:15:57 +0100 Subject: [PATCH 04/13] Update OC package --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index e27aebb..839a47a 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index a839cd8..a07325d 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + + From 1675f2c69e33ce66997bd685dac2af7eab7f69c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 23 Apr 2024 17:17:30 +0200 Subject: [PATCH 05/13] Update OC preview version. --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index 839a47a..228eb2f 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index a07325d..8783bb2 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + + From 5f596d91e198538ae42f63af0f8097bce710b2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 25 Apr 2024 12:50:34 +0200 Subject: [PATCH 06/13] Use the new DisplayDriver to inject registration checkbox Instead of the now-defunct AfterRegister zone. --- .../Drivers/RegistrationCheckboxDriver.cs | 12 +++++ .../RegistrationCheckboxInjectionFilter.cs | 47 ------------------- Lombiq.Privacy/Startup.cs | 10 ++-- 3 files changed, 18 insertions(+), 51 deletions(-) create mode 100644 Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs delete mode 100644 Lombiq.Privacy/Filters/RegistrationCheckboxInjectionFilter.cs diff --git a/Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs b/Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs new file mode 100644 index 0000000..a517ce7 --- /dev/null +++ b/Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs @@ -0,0 +1,12 @@ +using Lombiq.Privacy.ViewModels; +using OrchardCore.DisplayManagement.Handlers; +using OrchardCore.DisplayManagement.Views; +using OrchardCore.Users.Models; + +namespace Lombiq.Privacy.Drivers; + +public class RegistrationCheckboxDriver : DisplayDriver +{ + public override IDisplayResult Edit(RegisterUserForm model) => + Initialize("Lombiq_Privacy_RegistrationCheckbox", _ => { }); +} diff --git a/Lombiq.Privacy/Filters/RegistrationCheckboxInjectionFilter.cs b/Lombiq.Privacy/Filters/RegistrationCheckboxInjectionFilter.cs deleted file mode 100644 index 2d2cbb1..0000000 --- a/Lombiq.Privacy/Filters/RegistrationCheckboxInjectionFilter.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Lombiq.Privacy.ViewModels; -using Microsoft.AspNetCore.Mvc.Filters; -using OrchardCore.DisplayManagement; -using OrchardCore.DisplayManagement.Layout; -using OrchardCore.Modules; -using OrchardCore.Mvc.Core.Utilities; -using OrchardCore.Users.Controllers; -using System.Threading.Tasks; - -namespace Lombiq.Privacy.Filters; - -public class RegistrationCheckboxInjectionFilter : IAsyncResultFilter -{ - private readonly ILayoutAccessor _layoutAccessor; - private readonly IShapeFactory _shapeFactory; - - public RegistrationCheckboxInjectionFilter( - ILayoutAccessor layoutAccessor, - IShapeFactory shapeFactory) - { - _layoutAccessor = layoutAccessor; - _shapeFactory = shapeFactory; - } - - public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next) - { - var routeValues = context.ActionDescriptor.RouteValues; - if (context.IsNotFullViewRendering() || - !routeValues["Area"].EqualsOrdinalIgnoreCase($"{nameof(OrchardCore)}.{nameof(OrchardCore.Users)}") || - !routeValues["Controller"].EqualsOrdinalIgnoreCase(typeof(RegistrationController).ControllerName()) || - !routeValues["Action"].EqualsOrdinalIgnoreCase(nameof(RegistrationController.Register))) - { - await next(); - return; - } - - var layout = await _layoutAccessor.GetLayoutAsync(); - var afterRegisterZone = layout.Zones["AfterRegister"]; - var shape = await _shapeFactory.CreateAsync( - "Lombiq_Privacy_RegistrationCheckbox", - viewModel => viewModel.RegistrationCheckbox = false); - - await afterRegisterZone.AddAsync(shape); - - await next(); - } -} diff --git a/Lombiq.Privacy/Startup.cs b/Lombiq.Privacy/Startup.cs index 2ec5331..af57a83 100644 --- a/Lombiq.Privacy/Startup.cs +++ b/Lombiq.Privacy/Startup.cs @@ -1,3 +1,4 @@ +using Lombiq.HelpfulLibraries.AspNetCore.Extensions; using Lombiq.Privacy.Activities; using Lombiq.Privacy.Constants; using Lombiq.Privacy.Drivers; @@ -16,10 +17,12 @@ using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.Data.Migration; +using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Modules; using OrchardCore.Navigation; using OrchardCore.ResourceManagement; using OrchardCore.Users.Events; +using OrchardCore.Users.Models; using OrchardCore.Workflows.Helpers; using System; using System.Threading.Tasks; @@ -91,8 +94,8 @@ public class ConsentBannerStartup : StartupBase public override void ConfigureServices(IServiceCollection services) { services.AddTransient, ResourceManagementOptionsConfiguration>(); - services.Configure((options) => - options.Filters.Add(typeof(PrivacyConsentBannerInjectionFilter))); + services.AddAsyncResultFilter(); + services.Configure((options) => options.Filters.Add(typeof(PrivacyConsentBannerInjectionFilter))); services.AddDataMigration(); services.AddScoped(); } @@ -106,8 +109,7 @@ public class RegistrationConsentStartup : StartupBase public override void ConfigureServices(IServiceCollection services) { - services.Configure((options) => - options.Filters.Add(typeof(RegistrationCheckboxInjectionFilter))); + services.AddScoped, RegistrationCheckboxDriver>(); services.AddScoped(); services.AddDataMigration(); services.AddScoped(); From 1ec5776576b45f1d8a0601e9514c78d8f37be9f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 25 Apr 2024 13:00:15 +0200 Subject: [PATCH 07/13] Add missing location. --- Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs b/Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs index a517ce7..acbfb8f 100644 --- a/Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs +++ b/Lombiq.Privacy/Drivers/RegistrationCheckboxDriver.cs @@ -8,5 +8,6 @@ namespace Lombiq.Privacy.Drivers; public class RegistrationCheckboxDriver : DisplayDriver { public override IDisplayResult Edit(RegisterUserForm model) => - Initialize("Lombiq_Privacy_RegistrationCheckbox", _ => { }); + Initialize("Lombiq_Privacy_RegistrationCheckbox", _ => { }) + .Location("Content:after"); } From fb16171597fdbf4f226f7de7a26ecb1c2698320c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 25 Apr 2024 14:27:46 +0200 Subject: [PATCH 08/13] Remove duplicate filter. --- Lombiq.Privacy/Startup.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Lombiq.Privacy/Startup.cs b/Lombiq.Privacy/Startup.cs index af57a83..552f53a 100644 --- a/Lombiq.Privacy/Startup.cs +++ b/Lombiq.Privacy/Startup.cs @@ -95,7 +95,6 @@ public override void ConfigureServices(IServiceCollection services) { services.AddTransient, ResourceManagementOptionsConfiguration>(); services.AddAsyncResultFilter(); - services.Configure((options) => options.Filters.Add(typeof(PrivacyConsentBannerInjectionFilter))); services.AddDataMigration(); services.AddScoped(); } From 16aa406e8a64383e7b5dd003b5632661f2627987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 25 Apr 2024 14:47:53 +0200 Subject: [PATCH 09/13] unusing --- Lombiq.Privacy/Startup.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Lombiq.Privacy/Startup.cs b/Lombiq.Privacy/Startup.cs index 552f53a..d6e4f7b 100644 --- a/Lombiq.Privacy/Startup.cs +++ b/Lombiq.Privacy/Startup.cs @@ -10,7 +10,6 @@ using Lombiq.Privacy.Services; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; From a5ef837b23ff91229a7f6d2ac77385f4281be8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 25 Apr 2024 18:16:13 +0200 Subject: [PATCH 10/13] Update registration form IDs. --- .../Extensions/TestCaseUITestContextExtensions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Lombiq.Privacy.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.Privacy.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 6a73c84..5ab6379 100644 --- a/Lombiq.Privacy.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.Privacy.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -107,11 +107,11 @@ public static async Task TestRegistrationConsentCheckboxAsync(this UITestContext // Go to registration and create a new user. await context.GoToRegistrationPageAsync(); - await context.FillInWithRetriesAsync(By.Id("UserName"), TestUser.Name); - await context.FillInWithRetriesAsync(By.Id("Email"), TestUser.Email); - await context.FillInWithRetriesAsync(By.Id("Password"), TestUser.Password); - await context.FillInWithRetriesAsync(By.Id("ConfirmPassword"), TestUser.Password); - await context.SetCheckboxValueAsync(By.Id("RegistrationCheckbox"), isChecked: true); + await context.FillInWithRetriesAsync(By.Id("RegisterUserForm_UserName"), TestUser.Name); + await context.FillInWithRetriesAsync(By.Id("RegisterUserForm_Email"), TestUser.Email); + await context.FillInWithRetriesAsync(By.Id("RegisterUserForm_Password"), TestUser.Password); + await context.FillInWithRetriesAsync(By.Id("RegisterUserForm_ConfirmPassword"), TestUser.Password); + await context.SetCheckboxValueAsync(By.Id("RegisterUserForm_RegistrationCheckbox"), isChecked: true); await context.ClickReliablyOnSubmitAsync(); // Login with the created user. From c4551ece909d77f5b42e397cb04314130bb36f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 27 Apr 2024 19:31:52 +0200 Subject: [PATCH 11/13] Update OC package version. --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index 228eb2f..a2f9463 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index 8783bb2..11da461 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + + From d1ea383efa18a7f03f6e3d81fe1d3e877e2999cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 4 May 2024 12:57:04 +0200 Subject: [PATCH 12/13] Update OC versions --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index a2f9463..d656fd1 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index 11da461..c9d3b54 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + + From d852f9f7a919f419f84e983076148f22f906f102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 7 May 2024 21:08:59 +0200 Subject: [PATCH 13/13] Update OC to the latest preview. --- .../Lombiq.Privacy.Samples.csproj | 6 +++--- Lombiq.Privacy/Lombiq.Privacy.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj index d656fd1..e538f7f 100644 --- a/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj +++ b/Lombiq.Privacy.Samples/Lombiq.Privacy.Samples.csproj @@ -22,9 +22,9 @@ - - - + + + diff --git a/Lombiq.Privacy/Lombiq.Privacy.csproj b/Lombiq.Privacy/Lombiq.Privacy.csproj index c9d3b54..de9621b 100644 --- a/Lombiq.Privacy/Lombiq.Privacy.csproj +++ b/Lombiq.Privacy/Lombiq.Privacy.csproj @@ -33,15 +33,15 @@ - - - - - - - - - + + + + + + + + +