From 02a8f9ab5454f35254d3e914afd37455740c000a Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 7 Nov 2024 11:39:56 -0500 Subject: [PATCH 01/60] GH-86 :: Create registration widget directory --- .../Membership/Widgets/Registration/RegistrationWidget.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cs diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cs new file mode 100644 index 00000000..e69de29b From f3bdd3f76eb86f87b0dfb6a7eb28326dbe5de000 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 7 Nov 2024 17:17:30 -0500 Subject: [PATCH 02/60] GH-86 :: begin progress implementing registration --- .../Features/Membership/GuidesMember.cs | 78 +++++++++++++++ .../Widgets/Registration/RegisterModel.cs | 41 ++++++++ .../Registration/RegistrationController.cs | 49 ++++++++++ .../Registration/RegistrationWidget.cs | 0 .../RegistrationWidgetProperties.cs | 97 +++++++++++++++++++ .../RegistrationWidgetViewComponent.cs | 26 +++++ .../RegistrationWidgetViewModel.cs | 62 ++++++++++++ 7 files changed, 353 insertions(+) create mode 100644 src/TrainingGuides.Web/Features/Membership/GuidesMember.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs delete mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs diff --git a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs new file mode 100644 index 00000000..d2b0c3ae --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs @@ -0,0 +1,78 @@ +using CMS.Membership; +using Kentico.Membership; + +namespace TrainingGuides.Web.Features.Membership; + +public class GuidesMember : ApplicationUser +{ + public string GivenName { get; set; } = ""; + public string FamilyName { get; set; } = ""; + public bool FamilyNameFirst { get; set; } = false; + public string FullName => + (GivenName, FamilyName) switch + { + ("", "") => "", + (string given, "") => given, + ("", string family) => family, + (string given, string family) => + FamilyNameFirst ? $"{family} {given}" : $"{given} {family}", + (null, null) or _ => "", + }; + + public string FavoriteCoffee { get; set; } + public DateTime Created { get; set; } + + + + public override void MapToMemberInfo(MemberInfo target) + { + if (target is null) + { + throw new ArgumentNullException(nameof(target)); + } + + /* + * base.MapToMemberInfo will set target.MemberPassword everytime + * however we do not want to set it if PasswordHash is null, + * and this stores the original so we can revert it + */ + string originalPasswordHash = target.MemberPassword; + + base.MapToMemberInfo(target); + + if (PasswordHash is null) + { + target.MemberPassword = originalPasswordHash; + } + + _ = target.SetValue("MemberGivenName", GivenName); + _ = target.SetValue("MemberFamilyName", FamilyName); + _ = target.SetValue("FamilyNameFirst", FamilyNameFirst); + _ = target.SetValue("MemberFavoriteCoffee", FavoriteCoffee); + } + + public override void MapFromMemberInfo(MemberInfo source) + { + base.MapFromMemberInfo(source); + + GivenName = source.GetValue("MemberGivenName", ""); + FamilyName = source.GetValue("MemberFamilyName", ""); + FamilyNameFirst = source.GetValue("FamilyNameFirst", false); + FavoriteCoffee = source.GetValue("MemberFavoriteCoffee", ""); + Created = source.MemberCreated; + } + + public static GuidesMember FromMemberInfo(MemberInfo memberInfo) + { + var member = new Member(); + member.MapFromMemberInfo(memberInfo); + + return member; + } +} + +public static class MemberInfoExtensions +{ + public static GuidesMember AsMember(this MemberInfo member) => + GuidesMember.FromMemberInfo(member); +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs new file mode 100644 index 00000000..95975ef3 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs @@ -0,0 +1,41 @@ +using System.ComponentModel.DataAnnotations; + +public class RegisterModel +{ + + [DataType(DataType.Text)] + [Required()] + [RegularExpression("^[a-zA-Z0-9_\\-\\.]+$")] + [MaxLength(100)] + public string UserName { get; set; } = ""; + + [DataType(DataType.EmailAddress)] + [Required()] + [EmailAddress()] + [MaxLength(100)] + public string EmailAddress { get; set; } = ""; + + [DataType(DataType.Password)] + [Required()] + [MaxLength(100)] + public string Password { get; set; } = ""; + + [DataType(DataType.Password)] + [Required()] + [MaxLength(100)] + public string ConfirmPassword { get; set; } = ""; + + [DataType(DataType.Text)] + [MaxLength(100)] + public string GivenName { get; set; } = ""; + + [DataType(DataType.Text)] + [MaxLength(100)] + public string FamilyName { get; set; } = ""; + + public bool FamilyNameFirst { get; set; } = false; + + [DataType(DataType.Text)] + [MaxLength(100)] + public string FavoriteCoffee { get; set; } = ""; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs new file mode 100644 index 00000000..ae205914 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs @@ -0,0 +1,49 @@ +using CMS.Core; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Localization; +using TrainingGuides.Web.Features.Membership; + +public class RegistrationController(UserManager userManager, IEventLogService log, IStringLocalizer localizer) : Controller +{ + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Register(RegisterModel model) + { + var guidesMember = new GuidesMember + { + UserName = model.UserName, + Email = model.EmailAddress, + GivenName = model.GivenName, + FamilyName = model.FamilyName, + FamilyNameFirst = model.FamilyNameFirst, + FavoriteCoffee = model.FavoriteCoffee + }; + + var result = IdentityResult.Failed(); + try + { + result = await userManager.CreateAsync(guidesMember, model.Password); + } + catch (Exception ex) + { + log.LogException(nameof(RegistrationController), nameof(Register), ex); + result = IdentityResult.Failed([new() { Code = "Failure", Description = "Your registration was not successful." }]); + } + + if (result.Succeeded) + { + return Ok(localizer["Success"]); + } + else + { + foreach (string error in result.Errors.Select(e => e.Description)) + { + ModelState.AddModelError(string.Empty, error); + } + + return PartialView("~/Features/Registration/_RegisterForm.cshtml", model); + } + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs new file mode 100644 index 00000000..10b4e74d --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs @@ -0,0 +1,97 @@ +using Kentico.PageBuilder.Web.Mvc; +using Kentico.Xperience.Admin.Base.FormAnnotations; + +namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; + +public class RegistrationWidgetProperties : IWidgetProperties +{ + /// + /// Determines whether the widget should display the Given name and Family name fields. + /// + [CheckboxComponent( + Label = "Show name", + Order = 10)] + public bool ShowName { get; set; } = true; + + /// + /// Determines whether the widget should display extra fields. + /// + [CheckboxComponent( + Label = "Show extra fields", + Order = 20)] + public bool ShowExtraFields { get; set; } = true; + + /// + /// Form title + /// + [TextInputComponent( + Label = "Form title", + Order = 30)] + public string FormTitle { get; set; } = "Sign up"; + + /// + /// User name label. + /// + [TextInputComponent( + Label = "User name label", + Order = 40)] + public string UserNameLabel { get; set; } = "User name"; + + /// + /// Email address label. + /// + [TextInputComponent( + Label = "Email address label", + Order = 50)] + public string EmailAddressLabel { get; set; } = "Email address"; + + /// + /// Password label. + /// + [TextInputComponent( + Label = "Password label", + Order = 60)] + public string PasswordLabel { get; set; } = "Password"; + + /// + /// Password label. + /// + [TextInputComponent( + Label = "Confirm password label", + Order = 70)] + public string ConfirmPasswordLabel { get; set; } = "Confirm your password"; + + /// + /// Given name label. + /// + [TextInputComponent( + Label = "Given name label", + Order = 80)] + public string GivenNameLabel { get; set; } = "Given name"; + + /// + /// Family name label. + /// + [TextInputComponent( + Label = "Family name label", + Order = 90)] + public string FamilyNameLabel { get; set; } = "Family name"; + + /// + /// Label for checkbox that indicates that the family name should display first. + /// + [TextInputComponent( + PasswordLabel = "'Family name first' checkbox label", + Order = 100)] + )] + public bool FamilyNameFirstLabel { get; set; } + + /// + /// Favorite coffee label. + /// + [TextInputComponent( + Label = "Favorite coffee label", + Order = 110)] + public string FavoriteCoffeeLabel { get; set; } = "Favorite coffee"; + +} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs new file mode 100644 index 00000000..b1275cf1 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -0,0 +1,26 @@ + + +using Kentico.PageBuilder.Web.Mvc; +using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Membership.Widgets.Registration; + + + +[assembly: RegisterWidget( + identifier: RegistrationWidgetViewComponent.IDENTIFIER, + viewComponentType: typeof(RegistrationWidgetViewComponent), + name: "Registration", + propertiesType: typeof(RegistrationWidgetProperties), + Description = "Displays a registration form for members.", + IconClass = "icon-cookie")] + +namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; +public class RegistrationWidgetViewComponent : ViewComponent +{ + public const string IDENTIFIER = "TrainingGuides.RegistrationWidget"; + + public async Task InvokeAsync(RegistrationWidgetProperties properties) + { + return View(properties); + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs new file mode 100644 index 00000000..51cfae42 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs @@ -0,0 +1,62 @@ + + +namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; + +public class RegistrationWidgetViewModel +{ + /// + /// Determines whether the widget should display name-related fields. + /// + public bool ShowName { get; set; } + + /// + /// Determines whether the widget should display extra fields. + /// + public bool ShowExtraFields { get; set; } + + /// + /// Form title + /// + public string FormTitle { get; set; } = ""; + + /// + /// User name label. + /// + public string UserNameLabel { get; set; } = ""; + + /// + /// Email address label. + /// + public string EmailAddressLabel { get; set; } = ""; + + /// + /// Password label. + /// + public string PasswordLabel { get; set; } = ""; + + /// + /// Password label. + /// + public string ConfirmPasswordLabel { get; set; } = ""; + + /// + /// Given name label. + /// + public string GivenNameLabel { get; set; } = ""; + + /// + /// Family name label. + /// + public string FamilyNameLabel { get; set; } = ""; + + /// + /// Label for checkbox that indicates that the family name should display first. + /// + public bool FamilyNameFirstLabel { get; set; } + + /// + /// Favorite coffee label. + /// + public string FavoriteCoffeeLabel { get; set; } = ""; + +} From 4a6d75cf6fda7bd857d221ff9c1f6dc73db4c6bd Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 7 Nov 2024 17:19:48 -0500 Subject: [PATCH 03/60] GH-86 :: fix spelling in widget properties --- .../Widgets/Registration/RegistrationWidgetProperties.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs index 10b4e74d..157f2707 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs @@ -8,7 +8,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// /// Determines whether the widget should display the Given name and Family name fields. /// - [CheckboxComponent( + [CheckBoxComponent( Label = "Show name", Order = 10)] public bool ShowName { get; set; } = true; @@ -16,7 +16,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// /// Determines whether the widget should display extra fields. /// - [CheckboxComponent( + [CheckBoxComponent( Label = "Show extra fields", Order = 20)] public bool ShowExtraFields { get; set; } = true; @@ -81,9 +81,8 @@ public class RegistrationWidgetProperties : IWidgetProperties /// Label for checkbox that indicates that the family name should display first. /// [TextInputComponent( - PasswordLabel = "'Family name first' checkbox label", + Label = "'Family name first' checkbox label", Order = 100)] - )] public bool FamilyNameFirstLabel { get; set; } /// From 8f1041521475b45ff51591d37dd95e688122771e Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Fri, 8 Nov 2024 11:15:16 -0500 Subject: [PATCH 04/60] GH-86 :: progress --- .../Features/Membership/GuidesMember.cs | 10 +- .../Widgets/Registration/RegisterModel.cs | 3 + .../Registration/RegistrationController.cs | 2 +- .../Registration/RegistrationWidget.cshtml | 11 +++ .../RegistrationWidgetProperties.cs | 26 ++++-- .../RegistrationWidgetViewComponent.cs | 24 ++++- .../RegistrationWidgetViewModel.cs | 12 ++- .../Widgets/Registration/_RegisterForm.cshtml | 91 +++++++++++++++++++ src/TrainingGuides.Web/Program.cs | 17 ++++ 9 files changed, 175 insertions(+), 21 deletions(-) create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/_RegisterForm.cshtml diff --git a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs index d2b0c3ae..6ae34da6 100644 --- a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs +++ b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs @@ -14,12 +14,12 @@ public class GuidesMember : ApplicationUser ("", "") => "", (string given, "") => given, ("", string family) => family, - (string given, string family) => + (string given, string family) => FamilyNameFirst ? $"{family} {given}" : $"{given} {family}", (null, null) or _ => "", }; - public string FavoriteCoffee { get; set; } + public string FavoriteCoffee { get; set; } = ""; public DateTime Created { get; set; } @@ -64,10 +64,10 @@ public override void MapFromMemberInfo(MemberInfo source) public static GuidesMember FromMemberInfo(MemberInfo memberInfo) { - var member = new Member(); - member.MapFromMemberInfo(memberInfo); + var guidesMember = new GuidesMember(); + guidesMember.MapFromMemberInfo(memberInfo); - return member; + return guidesMember; } } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs index 95975ef3..ede04a14 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs @@ -1,7 +1,9 @@ using System.ComponentModel.DataAnnotations; +using TrainingGuides.Web.Features.Membership.Widgets.Registration; public class RegisterModel { + public RegistrationWidgetViewModel WidgetViewModel = new(); [DataType(DataType.Text)] [Required()] @@ -23,6 +25,7 @@ public class RegisterModel [DataType(DataType.Password)] [Required()] [MaxLength(100)] + [Compare(nameof(Password))] public string ConfirmPassword { get; set; } = ""; [DataType(DataType.Text)] diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs index ae205914..6d1d9c3a 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs @@ -7,7 +7,7 @@ public class RegistrationController(UserManager userManager, IEventLogService log, IStringLocalizer localizer) : Controller { - [HttpPost] + [HttpPost("/Registration/Register")] [ValidateAntiForgeryToken] public async Task Register(RegisterModel model) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml new file mode 100644 index 00000000..0cd34b09 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -0,0 +1,11 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.Registration + +@model RegistrationWidgetViewModel + +@{ + var registerModel = new RegisterModel(); + registerModel.WidgetViewModel = Model; +} + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs index 157f2707..978cf535 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs @@ -29,12 +29,20 @@ public class RegistrationWidgetProperties : IWidgetProperties Order = 30)] public string FormTitle { get; set; } = "Sign up"; + /// + /// Submit button text + /// + [TextInputComponent( + Label = "Submit button text", + Order = 40)] + public string SubmitButtonText { get; set; } = "Submit"; + /// /// User name label. /// [TextInputComponent( Label = "User name label", - Order = 40)] + Order = 50)] public string UserNameLabel { get; set; } = "User name"; /// @@ -42,7 +50,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Email address label", - Order = 50)] + Order = 60)] public string EmailAddressLabel { get; set; } = "Email address"; /// @@ -50,7 +58,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Password label", - Order = 60)] + Order = 70)] public string PasswordLabel { get; set; } = "Password"; /// @@ -58,7 +66,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Confirm password label", - Order = 70)] + Order = 80)] public string ConfirmPasswordLabel { get; set; } = "Confirm your password"; /// @@ -66,7 +74,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Given name label", - Order = 80)] + Order = 90)] public string GivenNameLabel { get; set; } = "Given name"; /// @@ -74,7 +82,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Family name label", - Order = 90)] + Order = 100)] public string FamilyNameLabel { get; set; } = "Family name"; /// @@ -82,15 +90,15 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "'Family name first' checkbox label", - Order = 100)] - public bool FamilyNameFirstLabel { get; set; } + Order = 110)] + public string FamilyNameFirstLabel { get; set; } = "Family name goes first"; /// /// Favorite coffee label. /// [TextInputComponent( Label = "Favorite coffee label", - Order = 110)] + Order = 120)] public string FavoriteCoffeeLabel { get; set; } = "Favorite coffee"; } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs index b1275cf1..2a5c6860 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -12,15 +12,29 @@ name: "Registration", propertiesType: typeof(RegistrationWidgetProperties), Description = "Displays a registration form for members.", - IconClass = "icon-cookie")] + IconClass = "icon-lines-rectangle-o")] namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; public class RegistrationWidgetViewComponent : ViewComponent { public const string IDENTIFIER = "TrainingGuides.RegistrationWidget"; - public async Task InvokeAsync(RegistrationWidgetProperties properties) - { - return View(properties); - } + public IViewComponentResult Invoke(RegistrationWidgetProperties properties) => + View("~/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml", new RegistrationWidgetViewModel + { + DisplayForm = true, //TODO add service method to check if member is currently signed in/out + ShowName = properties.ShowName, + ShowExtraFields = properties.ShowExtraFields, + FormTitle = properties.FormTitle, + SubmitButtonText = properties.SubmitButtonText, + UserNameLabel = properties.UserNameLabel, + EmailAddressLabel = properties.EmailAddressLabel, + PasswordLabel = properties.PasswordLabel, + ConfirmPasswordLabel = properties.ConfirmPasswordLabel, + GivenNameLabel = properties.GivenNameLabel, + FamilyNameLabel = properties.FamilyNameLabel, + FamilyNameFirstLabel = properties.FamilyNameFirstLabel, + FavoriteCoffeeLabel = properties.FavoriteCoffeeLabel + }); + } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs index 51cfae42..114aab3b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs @@ -4,6 +4,11 @@ namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; public class RegistrationWidgetViewModel { + /// + /// Determines whether the widget should display the form. + /// + public bool DisplayForm { get; set; } + /// /// Determines whether the widget should display name-related fields. /// @@ -19,6 +24,11 @@ public class RegistrationWidgetViewModel /// public string FormTitle { get; set; } = ""; + /// + /// Submit button text + /// + public string SubmitButtonText { get; set; } = ""; + /// /// User name label. /// @@ -52,7 +62,7 @@ public class RegistrationWidgetViewModel /// /// Label for checkbox that indicates that the family name should display first. /// - public bool FamilyNameFirstLabel { get; set; } + public string FamilyNameFirstLabel { get; set; } = ""; /// /// Favorite coffee label. diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/_RegisterForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/_RegisterForm.cshtml new file mode 100644 index 00000000..169a03ec --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/_RegisterForm.cshtml @@ -0,0 +1,91 @@ +@model RegisterModel +
+
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ @if (Model.WidgetViewModel.ShowName) + { +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ } + @if (Model.WidgetViewModel.ShowExtraFields) + { +
+
+ +
+
+ + +
+
+ } + + + +
+
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 7a7b93aa..4bc52dbb 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -2,13 +2,17 @@ using CMS.EmailEngine; using Kentico.Activities.Web.Mvc; using Kentico.Content.Web.Mvc.Routing; +using Kentico.Membership; + // using Kentico.CrossSiteTracking.Web.Mvc; // using Kentico.OnlineMarketing.Web.Mvc; using Kentico.PageBuilder.Web.Mvc; using Kentico.Web.Mvc; +using Microsoft.AspNetCore.Identity; using TrainingGuides; using TrainingGuides.Web; using TrainingGuides.Web.Features.DataProtection.Shared; +using TrainingGuides.Web.Features.Membership; using TrainingGuides.Web.Features.Shared.Helpers; //using TrainingGuides.Web.Features.Shared.Helpers.Startup; @@ -74,6 +78,19 @@ options.CookieConfigurations.Add(CookieNames.COOKIE_ACCEPTANCE, CookieLevel.System); }); + +builder.Services.AddIdentity(options => +{ + options.SignIn.RequireConfirmedAccount = true; + options.User.RequireUniqueEmail = false;//change this once we add email functionality +}) + .AddUserStore>() + .AddRoleStore() + .AddUserManager>() + .AddSignInManager>(); + +builder.Services.AddAuthorization(); + builder.Services.AddAuthentication(); builder.Services.AddUnobtrusiveAjax(); From cc1370805005bf51d22fe8d64e30caa0549a9acf Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Fri, 8 Nov 2024 12:49:43 -0500 Subject: [PATCH 05/60] GH-86 :: registration widget progress --- .../Widgets/Registration/RegisterModel.cs | 6 +++--- .../Registration/RegistrationController.cs | 7 ++++--- ...terForm.cshtml => RegistrationForm.cshtml} | 0 .../Registration/RegistrationWidget.cshtml | 16 ++++++++++----- .../RegistrationWidgetViewComponent.cs | 20 +++++++++++++++++-- .../RegistrationWidgetViewModel.cs | 5 +++++ src/TrainingGuides.Web/Program.cs | 2 +- 7 files changed, 42 insertions(+), 14 deletions(-) rename src/TrainingGuides.Web/Features/Membership/Widgets/Registration/{_RegisterForm.cshtml => RegistrationForm.cshtml} (100%) diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs index ede04a14..2833fabe 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs @@ -3,17 +3,17 @@ public class RegisterModel { - public RegistrationWidgetViewModel WidgetViewModel = new(); + public RegistrationWidgetViewModel WidgetViewModel = new();//TODO replace with flat properties, do hiddenfor, so they can be used in the controller [DataType(DataType.Text)] - [Required()] + [Required(ErrorMessage = "Please enter a valid email address")] [RegularExpression("^[a-zA-Z0-9_\\-\\.]+$")] [MaxLength(100)] public string UserName { get; set; } = ""; [DataType(DataType.EmailAddress)] [Required()] - [EmailAddress()] + [EmailAddress(ErrorMessage = "Please enter a valid email address")] [MaxLength(100)] public string EmailAddress { get; set; } = ""; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs index 6d1d9c3a..83930913 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs @@ -2,9 +2,10 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; +using TrainingGuides.Admin; using TrainingGuides.Web.Features.Membership; -public class RegistrationController(UserManager userManager, IEventLogService log, IStringLocalizer localizer) : Controller +public class RegistrationController(UserManager userManager, IEventLogService log, IStringLocalizer localizer) : Controller { [HttpPost("/Registration/Register")] @@ -29,7 +30,7 @@ public async Task Register(RegisterModel model) catch (Exception ex) { log.LogException(nameof(RegistrationController), nameof(Register), ex); - result = IdentityResult.Failed([new() { Code = "Failure", Description = "Your registration was not successful." }]); + result = IdentityResult.Failed([new() { Code = "Failure", Description = localizer["Registration failed"] }]); } if (result.Succeeded) @@ -43,7 +44,7 @@ public async Task Register(RegisterModel model) ModelState.AddModelError(string.Empty, error); } - return PartialView("~/Features/Registration/_RegisterForm.cshtml", model); + return PartialView("~/Features/Membership/Widgets/Registration/RegistrationForm.cshtml", model); } } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/_RegisterForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml similarity index 100% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Registration/_RegisterForm.cshtml rename to src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index 0cd34b09..0118af23 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -1,11 +1,17 @@ @using TrainingGuides.Web.Features.Membership.Widgets.Registration -@model RegistrationWidgetViewModel +@model RegisterModel @{ - var registerModel = new RegisterModel(); - registerModel.WidgetViewModel = Model; + var formDivId = $"registerForm{Guid.NewGuid()}"; } - - \ No newline at end of file +@using (Html.AjaxBeginForm("Register", "Registration", new AjaxOptions + { + HttpMethod = "POST", + InsertionMode = InsertionMode.Replace, + UpdateTargetId = formDivId + }, new { action = $"{Model.WidgetViewModel.BaseUrl}/Registration/Register" })) + { + + } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs index 2a5c6860..948db5d5 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -3,6 +3,7 @@ using Kentico.PageBuilder.Web.Mvc; using Microsoft.AspNetCore.Mvc; using TrainingGuides.Web.Features.Membership.Widgets.Registration; +using TrainingGuides.Web.Features.Shared.Services; @@ -17,11 +18,19 @@ namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; public class RegistrationWidgetViewComponent : ViewComponent { + private readonly IHttpRequestService httpRequestService; public const string IDENTIFIER = "TrainingGuides.RegistrationWidget"; - public IViewComponentResult Invoke(RegistrationWidgetProperties properties) => - View("~/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml", new RegistrationWidgetViewModel + public RegistrationWidgetViewComponent(IHttpRequestService httpRequestService) + { + this.httpRequestService = httpRequestService; + } + + public IViewComponentResult Invoke(RegistrationWidgetProperties properties) + { + var widgetViewModel = new RegistrationWidgetViewModel { + BaseUrl = httpRequestService.GetBaseUrl(), DisplayForm = true, //TODO add service method to check if member is currently signed in/out ShowName = properties.ShowName, ShowExtraFields = properties.ShowExtraFields, @@ -35,6 +44,13 @@ public IViewComponentResult Invoke(RegistrationWidgetProperties properties) => FamilyNameLabel = properties.FamilyNameLabel, FamilyNameFirstLabel = properties.FamilyNameFirstLabel, FavoriteCoffeeLabel = properties.FavoriteCoffeeLabel + }; + + return View("~/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml", new RegisterModel + { + WidgetViewModel = widgetViewModel }); + } + } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs index 114aab3b..e59c8a32 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs @@ -4,6 +4,11 @@ namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; public class RegistrationWidgetViewModel { + /// + /// The Base URL of the site + /// + public string BaseUrl { get; set; } = ""; + /// /// Determines whether the widget should display the form. /// diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 4bc52dbb..3d2fba68 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -79,7 +79,7 @@ }); -builder.Services.AddIdentity(options => +builder.Services.AddIdentity(options => { options.SignIn.RequireConfirmedAccount = true; options.User.RequireUniqueEmail = false;//change this once we add email functionality From a65c2e7f94ac2713e44cf802f5a584fd1e641420 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Fri, 8 Nov 2024 13:12:35 -0500 Subject: [PATCH 06/60] GH-89 :: add membership service - menat to handle all user manager stuff --- .../Membership/Services/IMembershipService.cs | 6 ++++ .../Membership/Services/MembershipService.cs | 31 +++++++++++++++++++ .../ServiceCollectionExtensions.cs | 2 ++ 3 files changed, 39 insertions(+) create mode 100644 src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs new file mode 100644 index 00000000..81782b02 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -0,0 +1,6 @@ +namespace TrainingGuides.Web.Features.Membership.Services; +public interface IMembershipService +{ + public Task GetMember(); + public Task IsMemberAuthenticated(); +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs new file mode 100644 index 00000000..b274f5e8 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Identity; + +namespace TrainingGuides.Web.Features.Membership.Services; +public class MembershipService : IMembershipService +{ + private readonly UserManager userManager; + private readonly IHttpContextAccessor contextAccessor; + public MembershipService( + UserManager userManager, + IHttpContextAccessor contextAccessor) + { + this.userManager = userManager; + this.contextAccessor = contextAccessor; + } + + public async Task GetMember() + { + var context = contextAccessor.HttpContext; + if (context is null) + { + return null; + } + + return await userManager.GetUserAsync(context.User); + } + public async Task IsMemberAuthenticated() + { + var member = await GetMember(); + return member is not null; + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/ServiceCollectionExtensions.cs b/src/TrainingGuides.Web/ServiceCollectionExtensions.cs index e5ad2cbb..1b69b46f 100644 --- a/src/TrainingGuides.Web/ServiceCollectionExtensions.cs +++ b/src/TrainingGuides.Web/ServiceCollectionExtensions.cs @@ -5,6 +5,7 @@ using TrainingGuides.Web.Features.SEO; using TrainingGuides.Web.Features.Shared.Services; using TrainingGuides.Web.Features.EmailNotifications; +using TrainingGuides.Web.Features.Membership.Services; namespace TrainingGuides.Web; @@ -22,6 +23,7 @@ public static void AddTrainingGuidesServices(this IServiceCollection services) services.AddSingleton(); services.AddSingleton(); + services.AddScoped(); services.AddScoped(); services.AddTransient(typeof(IContentItemRetrieverService<>), typeof(ContentItemRetrieverService<>)); From ce2b417e332b702d91fb8dde6ab91606cff74e96 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Mon, 11 Nov 2024 23:52:31 -0500 Subject: [PATCH 07/60] GH-89 :: sign in widget WIP --- .../Authentication/LoginViewModelTests.cs | 23 +++++++++ .../Widgets/Authentication/SignInForm.cshtml | 34 +++++++++++++ .../Widgets/Authentication/SignInViewModel.cs | 19 +++++++ .../Authentication/SignInWidget.cshtml | 17 +++++++ .../Authentication/SignInWidgetProperties.cs | 47 +++++++++++++++++ .../SignInWidgetViewComponent.cs | 51 +++++++++++++++++++ .../Authentication/SignInWidgetViewModel.cs | 39 ++++++++++++++ 7 files changed, 230 insertions(+) create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInForm.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidget.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetProperties.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewComponent.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewModel.cs diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs new file mode 100644 index 00000000..5f796a7a --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs @@ -0,0 +1,23 @@ +using Xunit; +using TrainingGuides.Web.Features.Widgets.Authentication; + +namespace TrainingGuides.Web.Tests.Features.Articles; + +public class LoginViewModelTests +{ + private readonly SignInViewModel loginViewModel; + + public LoginViewModelTests() + { + loginViewModel = new(); + } + + [Fact] + public void WhenInitialized_UserNameOrEmail_IsEmpty() => Assert.Equal(string.Empty, loginViewModel.UserNameOrEmail); + + [Fact] + public void WhenInitialized_Password_IsEmpty() => Assert.Equal(string.Empty, loginViewModel.Password); + + [Fact] + public void WhenInitialized_StaySignedIn_IsFalse() => Assert.False(loginViewModel.StaySignedIn); +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInForm.cshtml new file mode 100644 index 00000000..3fe10a18 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInForm.cshtml @@ -0,0 +1,34 @@ +@using TrainingGuides.Web.Features.Widgets.Authentication +@model SignInViewModel + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+
+
+ + +
+ +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs new file mode 100644 index 00000000..eb41f69f --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using TrainingGuides.Web.Features.Membership.Widgets.Authentication; + +namespace TrainingGuides.Web.Features.Widgets.Authentication; + +public class SignInViewModel +{ + [Required(ErrorMessage = "Please enter your user name or email address")] + [MaxLength(100, ErrorMessage = "Maximum allowed length of the input text is {1}")] + public string UserNameOrEmail { get; set; } = string.Empty; + + [DataType(DataType.Password)] + [MaxLength(100, ErrorMessage = "Maximum allowed length of the input text is {1}")] + public string Password { get; set; } = string.Empty; + + public bool StaySignedIn { get; set; } = false; + + public SignInWidgetViewModel Labels { get; set; } = new(); +} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidget.cshtml new file mode 100644 index 00000000..8dabe1ae --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidget.cshtml @@ -0,0 +1,17 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.Authentication + +@model SignInWidgetViewModel + +@{ + var formDivId = $"signInForm{Guid.NewGuid()}"; +} + +@using (Html.AjaxBeginForm("Autheticate", "Authentication", new AjaxOptions + { + HttpMethod = "POST", + InsertionMode = InsertionMode.Replace, + UpdateTargetId = formDivId + }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) + { + + } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetProperties.cs new file mode 100644 index 00000000..6b04118f --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetProperties.cs @@ -0,0 +1,47 @@ +using Kentico.PageBuilder.Web.Mvc; +using Kentico.Xperience.Admin.Base.FormAnnotations; + +namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; + +public class SignInWidgetProperties : IWidgetProperties +{ + /// + /// Form title + /// + [TextInputComponent( + Label = "Form title", + Order = 10)] + public string FormTitle { get; set; } = "Sign in"; + + /// + /// Submit button text + /// + [TextInputComponent( + Label = "Submit button text", + Order = 20)] + public string SubmitButtonText { get; set; } = "Sign in"; + + /// + /// User name or email label. + /// + [TextInputComponent( + Label = "User name or email label", + Order = 30)] + public string UserNameLabel { get; set; } = "User name or email"; + + /// + /// Password label. + /// + [TextInputComponent( + Label = "Password label", + Order = 40)] + public string PasswordLabel { get; set; } = "Password"; + + /// + /// Stay signed in label. + /// + [TextInputComponent( + Label = "Stay signed in label", + Order = 50)] + public string StaySignedInLabel { get; set; } = "Stay signed in"; +} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewComponent.cs new file mode 100644 index 00000000..7c02dacd --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewComponent.cs @@ -0,0 +1,51 @@ +using Kentico.PageBuilder.Web.Mvc; +using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Widgets.Authentication; +using TrainingGuides.Web.Features.Shared.Services; +using TrainingGuides.Web.Features.Widgets.Authentication; + +[assembly: RegisterWidget( + identifier: SignInWidgetViewComponent.IDENTIFIER, + viewComponentType: typeof(SignInWidgetViewComponent), + name: "SignIn", + propertiesType: typeof(SignInWidgetProperties), + Description = "Displays a sign in form for members.", + IconClass = "icon-lines-rectangle-o")] + +namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; +public class SignInWidgetViewComponent : ViewComponent +{ + private readonly IHttpRequestService httpRequestService; + private readonly IMembershipService membershipService; + public const string IDENTIFIER = "TrainingGuides.SignInWidget"; + + public SignInWidgetViewComponent( + IHttpRequestService httpRequestService, + IMembershipService membershipService) + { + this.httpRequestService = httpRequestService; + this.membershipService = membershipService; + } + + public async Task InvokeAsync(SignInWidgetProperties properties) + { + var widgetViewModel = new SignInWidgetViewModel + { + BaseUrl = httpRequestService.GetBaseUrl(), + DisplayForm = await membershipService.IsMemberAuthenticated(), + FormTitle = properties.FormTitle, + SubmitButtonText = properties.SubmitButtonText, + UserNameOrEmailLabel = properties.UserNameLabel, + PasswordLabel = properties.PasswordLabel, + StaySignedInLabel = properties.StaySignedInLabel + }; + + return View("~/Features/Membership/Widgets/Authentication/AuthenticationWidget.cshtml", new SignInViewModel + { + Labels = widgetViewModel + }); + } + + +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewModel.cs new file mode 100644 index 00000000..8fb9bd48 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewModel.cs @@ -0,0 +1,39 @@ +namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; + +public class SignInWidgetViewModel +{ + /// + /// The Base URL of the site + /// + public string BaseUrl { get; set; } = string.Empty; + + /// + /// The Base URL of the site + /// + public bool DisplayForm { get; set; } = true; + + /// + /// Form title + /// + public string FormTitle { get; set; } = string.Empty; + + /// + /// Submit button text + /// + public string SubmitButtonText { get; set; } = string.Empty; + + /// + /// User name or email label. + /// + public string UserNameOrEmailLabel { get; set; } = string.Empty; + + /// + /// Password label. + /// + public string PasswordLabel { get; set; } = string.Empty; + + /// + /// Stay signed in label. + /// + public string StaySignedInLabel { get; set; } = string.Empty; +} From ac553aa6407d46b4237d68e1408dbeba699ade5f Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 10:03:28 -0500 Subject: [PATCH 08/60] GH-86 :: updates to registration server-side form validation --- .../Widgets/Registration/RegisterModel.cs | 44 -------------- .../Registration/RegistrationController.cs | 42 +++++++------ .../Registration/RegistrationForm.cshtml | 42 +++++++++---- .../Registration/RegistrationWidget.cshtml | 8 ++- .../RegistrationWidgetViewComponent.cs | 7 +-- .../RegistrationWidgetViewModel.cs | 60 ++++++++++++++++++- 6 files changed, 117 insertions(+), 86 deletions(-) delete mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs deleted file mode 100644 index 2833fabe..00000000 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegisterModel.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using TrainingGuides.Web.Features.Membership.Widgets.Registration; - -public class RegisterModel -{ - public RegistrationWidgetViewModel WidgetViewModel = new();//TODO replace with flat properties, do hiddenfor, so they can be used in the controller - - [DataType(DataType.Text)] - [Required(ErrorMessage = "Please enter a valid email address")] - [RegularExpression("^[a-zA-Z0-9_\\-\\.]+$")] - [MaxLength(100)] - public string UserName { get; set; } = ""; - - [DataType(DataType.EmailAddress)] - [Required()] - [EmailAddress(ErrorMessage = "Please enter a valid email address")] - [MaxLength(100)] - public string EmailAddress { get; set; } = ""; - - [DataType(DataType.Password)] - [Required()] - [MaxLength(100)] - public string Password { get; set; } = ""; - - [DataType(DataType.Password)] - [Required()] - [MaxLength(100)] - [Compare(nameof(Password))] - public string ConfirmPassword { get; set; } = ""; - - [DataType(DataType.Text)] - [MaxLength(100)] - public string GivenName { get; set; } = ""; - - [DataType(DataType.Text)] - [MaxLength(100)] - public string FamilyName { get; set; } = ""; - - public bool FamilyNameFirst { get; set; } = false; - - [DataType(DataType.Text)] - [MaxLength(100)] - public string FavoriteCoffee { get; set; } = ""; -} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs index 83930913..246e59df 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs @@ -10,32 +10,36 @@ public class RegistrationController(UserManager userManager, IEven [HttpPost("/Registration/Register")] [ValidateAntiForgeryToken] - public async Task Register(RegisterModel model) + public async Task Register(RegistrationWidgetViewModel model) { - var guidesMember = new GuidesMember - { - UserName = model.UserName, - Email = model.EmailAddress, - GivenName = model.GivenName, - FamilyName = model.FamilyName, - FamilyNameFirst = model.FamilyNameFirst, - FavoriteCoffee = model.FavoriteCoffee - }; - var result = IdentityResult.Failed(); - try - { - result = await userManager.CreateAsync(guidesMember, model.Password); - } - catch (Exception ex) + + if (ModelState.IsValid) { - log.LogException(nameof(RegistrationController), nameof(Register), ex); - result = IdentityResult.Failed([new() { Code = "Failure", Description = localizer["Registration failed"] }]); + var guidesMember = new GuidesMember + { + UserName = model.UserName, + Email = model.EmailAddress, + GivenName = model.GivenName, + FamilyName = model.FamilyName, + FamilyNameFirst = model.FamilyNameFirst, + FavoriteCoffee = model.FavoriteCoffee + }; + + try + { + result = await userManager.CreateAsync(guidesMember, model.Password); + } + catch (Exception ex) + { + log.LogException(nameof(RegistrationController), nameof(Register), ex); + result = IdentityResult.Failed([new() { Code = "Failure", Description = localizer["Registration failed."] }]); + } } if (result.Succeeded) { - return Ok(localizer["Success"]); + return Content(localizer["Success!"]); } else { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml index 169a03ec..bfbd3f5d 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml @@ -1,11 +1,29 @@ -@model RegisterModel +@model RegistrationWidgetViewModel
+ + @* Include hidden inputs for widget display and links. + If server-side validation fails, these values will allow the form to be properly re-rendered. *@ + + + + + + + + + + + + + + +
- +
@@ -14,7 +32,7 @@
- +
@@ -23,7 +41,7 @@
- +
@@ -33,18 +51,18 @@
- +
- @if (Model.WidgetViewModel.ShowName) + @if (Model.ShowName) {
- +
@@ -54,7 +72,7 @@
- +
@@ -64,7 +82,7 @@
- +
@@ -72,11 +90,11 @@
} - @if (Model.WidgetViewModel.ShowExtraFields) + @if (Model.ShowExtraFields) {
- +
@@ -86,6 +104,6 @@ } - +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index 0118af23..fff43183 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -1,6 +1,6 @@ @using TrainingGuides.Web.Features.Membership.Widgets.Registration -@model RegisterModel +@model RegistrationWidgetViewModel @{ var formDivId = $"registerForm{Guid.NewGuid()}"; @@ -11,7 +11,9 @@ HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = formDivId - }, new { action = $"{Model.WidgetViewModel.BaseUrl}/Registration/Register" })) + }, new { action = $"{Model.BaseUrl}/Registration/Register" })) { - +
+ +
} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs index 948db5d5..e7c1dc14 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -28,7 +28,7 @@ public RegistrationWidgetViewComponent(IHttpRequestService httpRequestService) public IViewComponentResult Invoke(RegistrationWidgetProperties properties) { - var widgetViewModel = new RegistrationWidgetViewModel + var registerModel = new RegistrationWidgetViewModel { BaseUrl = httpRequestService.GetBaseUrl(), DisplayForm = true, //TODO add service method to check if member is currently signed in/out @@ -46,10 +46,7 @@ public IViewComponentResult Invoke(RegistrationWidgetProperties properties) FavoriteCoffeeLabel = properties.FavoriteCoffeeLabel }; - return View("~/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml", new RegisterModel - { - WidgetViewModel = widgetViewModel - }); + return View("~/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml", registerModel); } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs index e59c8a32..79af10cd 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs @@ -1,77 +1,131 @@ - - -namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +// using TrainingGuides.Web.Features.Membership.Widgets.Registration; public class RegistrationWidgetViewModel { + //WIDGET DISPLAY PROPERTIES + /// /// The Base URL of the site /// + [HiddenInput] public string BaseUrl { get; set; } = ""; /// /// Determines whether the widget should display the form. /// + [HiddenInput] public bool DisplayForm { get; set; } /// /// Determines whether the widget should display name-related fields. /// + [HiddenInput] public bool ShowName { get; set; } /// /// Determines whether the widget should display extra fields. /// + [HiddenInput] public bool ShowExtraFields { get; set; } /// /// Form title /// + [HiddenInput] public string FormTitle { get; set; } = ""; /// /// Submit button text /// + [HiddenInput] public string SubmitButtonText { get; set; } = ""; /// /// User name label. /// + [HiddenInput] public string UserNameLabel { get; set; } = ""; /// /// Email address label. /// + [HiddenInput] public string EmailAddressLabel { get; set; } = ""; /// /// Password label. /// + [HiddenInput] public string PasswordLabel { get; set; } = ""; /// /// Password label. /// + [HiddenInput] public string ConfirmPasswordLabel { get; set; } = ""; /// /// Given name label. /// + [HiddenInput] public string GivenNameLabel { get; set; } = ""; /// /// Family name label. /// + [HiddenInput] public string FamilyNameLabel { get; set; } = ""; /// /// Label for checkbox that indicates that the family name should display first. /// + [HiddenInput] public string FamilyNameFirstLabel { get; set; } = ""; /// /// Favorite coffee label. /// + [HiddenInput] public string FavoriteCoffeeLabel { get; set; } = ""; + //FORM PROPERTIES + + [DataType(DataType.Text)] + [Required()] + [RegularExpression("^[a-zA-Z0-9_\\-\\.]+$")] + [MaxLength(100)] + public string UserName { get; set; } = ""; + + [DataType(DataType.EmailAddress)] + [Required()] + [EmailAddress()] + [MaxLength(100)] + public string EmailAddress { get; set; } = ""; + + [DataType(DataType.Password)] + [Required()] + [MaxLength(100)] + public string Password { get; set; } = ""; + + [DataType(DataType.Password)] + [Required()] + [MaxLength(100)] + [Compare(nameof(Password))] + public string ConfirmPassword { get; set; } = ""; + + [DataType(DataType.Text)] + [MaxLength(100)] + public string GivenName { get; set; } = ""; + + [DataType(DataType.Text)] + [MaxLength(100)] + public string FamilyName { get; set; } = ""; + + public bool FamilyNameFirst { get; set; } = false; + + [DataType(DataType.Text)] + [MaxLength(100)] + public string FavoriteCoffee { get; set; } = ""; } From 3e80516c3c7384adc09fe94190269418faf7202a Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 10:47:22 -0500 Subject: [PATCH 09/60] GH-86 :: move UserManager code for registration into the MambershipService, extend the MemberInfo class to reflect custom fields --- .../cms.systemtable_cms.member/edit.xml | 40 +++++++++++++++++++ .../@global/cms.systemtable/cms.member.xml | 4 ++ .../Membership/Services/IMembershipService.cs | 3 ++ .../Membership/Services/MembershipService.cs | 2 + .../Registration/RegistrationController.cs | 6 ++- .../Registration/RegistrationForm.cshtml | 2 +- 6 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml index a7de4c46..794fed23 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml @@ -58,6 +58,46 @@ + + + Kentico.Administration.TextInput + + + False + Given name + False + + + + + Kentico.Administration.TextInput + + + False + Family name + False + + + + + Kentico.Administration.Checkbox + + + False + Family name goes first + False + + + + + Kentico.Administration.TextInput + + + False + Favorite coffee + False + + Edit diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml index 4d7bab30..bb8b05e4 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml @@ -16,6 +16,10 @@ + + + + 07c5d145-7cbc-4c75-9a96-6d4948bf6c73 diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 81782b02..2009d41c 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -1,6 +1,9 @@ +using Microsoft.AspNetCore.Identity; + namespace TrainingGuides.Web.Features.Membership.Services; public interface IMembershipService { public Task GetMember(); public Task IsMemberAuthenticated(); + public Task CreateMember(GuidesMember member, string password); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index b274f5e8..92e596b9 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -28,4 +28,6 @@ public async Task IsMemberAuthenticated() var member = await GetMember(); return member is not null; } + + public async Task CreateMember(GuidesMember member, string password) => await userManager.CreateAsync(member, password); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs index 246e59df..996087cd 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs @@ -4,8 +4,9 @@ using Microsoft.Extensions.Localization; using TrainingGuides.Admin; using TrainingGuides.Web.Features.Membership; +using TrainingGuides.Web.Features.Membership.Services; -public class RegistrationController(UserManager userManager, IEventLogService log, IStringLocalizer localizer) : Controller +public class RegistrationController(IMembershipService membershipService, IEventLogService log, IStringLocalizer localizer) : Controller { [HttpPost("/Registration/Register")] @@ -28,7 +29,8 @@ public async Task Register(RegistrationWidgetViewModel model) try { - result = await userManager.CreateAsync(guidesMember, model.Password); + + result = await membershipService.CreateMember(guidesMember, model.Password); } catch (Exception ex) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml index bfbd3f5d..6043cd14 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml @@ -23,7 +23,7 @@
- +
From 8c849eaad3d347b9de5fbc32c10772684bc59e7c Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 10:49:01 -0500 Subject: [PATCH 10/60] GH-86 :: fix label in registration form --- .../Membership/Widgets/Registration/RegistrationForm.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml index 6043cd14..6f04dfc6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml @@ -23,7 +23,7 @@
- +
From 092a426206bd4c8d64ce34f0ca497bcdba6396b6 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 11:06:57 -0500 Subject: [PATCH 11/60] GH-86 :: add title to registration form and fix typo in custom MemberInfo field name --- src/TrainingGuides.Web/Features/Membership/GuidesMember.cs | 4 ++-- .../Membership/Widgets/Registration/RegistrationWidget.cshtml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs index 6ae34da6..ea4c784f 100644 --- a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs +++ b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs @@ -47,7 +47,7 @@ public override void MapToMemberInfo(MemberInfo target) _ = target.SetValue("MemberGivenName", GivenName); _ = target.SetValue("MemberFamilyName", FamilyName); - _ = target.SetValue("FamilyNameFirst", FamilyNameFirst); + _ = target.SetValue("MemberFamilyNameFirst", FamilyNameFirst); _ = target.SetValue("MemberFavoriteCoffee", FavoriteCoffee); } @@ -57,7 +57,7 @@ public override void MapFromMemberInfo(MemberInfo source) GivenName = source.GetValue("MemberGivenName", ""); FamilyName = source.GetValue("MemberFamilyName", ""); - FamilyNameFirst = source.GetValue("FamilyNameFirst", false); + FamilyNameFirst = source.GetValue("MemberFamilyNameFirst", false); FavoriteCoffee = source.GetValue("MemberFavoriteCoffee", ""); Created = source.MemberCreated; } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index fff43183..d9d74a53 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -6,6 +6,8 @@ var formDivId = $"registerForm{Guid.NewGuid()}"; } +

@Model.FormTitle

+ @using (Html.AjaxBeginForm("Register", "Registration", new AjaxOptions { HttpMethod = "POST", From a4f86b618c62917161ec38248bae40713904d393 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 12 Nov 2024 14:29:06 -0500 Subject: [PATCH 12/60] GH-89 :: sign in widget WIP, relocate Authentication and registration controllers. --- src/Directory.Packages.props | 1 + .../Authentication/LoginViewModelTests.cs | 23 ----- .../SignInWidgetViewModelTests.cs | 44 ++++++++++ .../packages.lock.json | 10 +++ .../Controllers/AuthenticationController.cs | 84 +++++++++++++++++++ .../RegistrationController.cs | 7 +- .../Membership/Services/IMembershipService.cs | 3 +- .../Membership/Services/MembershipService.cs | 7 +- .../Widgets/Authentication/SignInViewModel.cs | 19 ----- .../SignInForm.cshtml | 13 +-- .../SignInWidget.cshtml | 0 .../SignInWidgetProperties.cs | 0 .../SignInWidgetViewComponent.cs | 8 +- .../SignInWidgetViewModel.cs | 28 ++++++- .../TrainingGuides.Web.csproj | 1 + src/TrainingGuides.Web/packages.lock.json | 9 ++ 16 files changed, 195 insertions(+), 62 deletions(-) delete mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs rename src/TrainingGuides.Web/Features/Membership/{Widgets/Registration => Controllers}/RegistrationController.cs (83%) delete mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs rename src/TrainingGuides.Web/Features/Membership/Widgets/{Authentication => SignIn}/SignInForm.cshtml (77%) rename src/TrainingGuides.Web/Features/Membership/Widgets/{Authentication => SignIn}/SignInWidget.cshtml (100%) rename src/TrainingGuides.Web/Features/Membership/Widgets/{Authentication => SignIn}/SignInWidgetProperties.cs (100%) rename src/TrainingGuides.Web/Features/Membership/Widgets/{Authentication => SignIn}/SignInWidgetViewComponent.cs (89%) rename src/TrainingGuides.Web/Features/Membership/Widgets/{Authentication => SignIn}/SignInWidgetViewModel.cs (56%) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 8c7dd991..007ba543 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -9,6 +9,7 @@ all + diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs deleted file mode 100644 index 5f796a7a..00000000 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/LoginViewModelTests.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Xunit; -using TrainingGuides.Web.Features.Widgets.Authentication; - -namespace TrainingGuides.Web.Tests.Features.Articles; - -public class LoginViewModelTests -{ - private readonly SignInViewModel loginViewModel; - - public LoginViewModelTests() - { - loginViewModel = new(); - } - - [Fact] - public void WhenInitialized_UserNameOrEmail_IsEmpty() => Assert.Equal(string.Empty, loginViewModel.UserNameOrEmail); - - [Fact] - public void WhenInitialized_Password_IsEmpty() => Assert.Equal(string.Empty, loginViewModel.Password); - - [Fact] - public void WhenInitialized_StaySignedIn_IsFalse() => Assert.False(loginViewModel.StaySignedIn); -} \ No newline at end of file diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs new file mode 100644 index 00000000..5ae9bde7 --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs @@ -0,0 +1,44 @@ +using Xunit; +using TrainingGuides.Web.Features.Membership.Widgets.Authentication; + +namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.Authentication; + +public class SignInWidgetViewModelTests +{ + private readonly SignInWidgetViewModel viewModel; + + public SignInWidgetViewModelTests() + { + viewModel = new(); + } + + [Fact] + public void WhenInitialized_BaseUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.BaseUrl); + + [Fact] + public void WhenInitialized_DisplayForm_IsTrue() => Assert.True(viewModel.DisplayForm); + + [Fact] + public void WhenInitialized_FormTitle_IsEmpty() => Assert.Equal(string.Empty, viewModel.FormTitle); + + [Fact] + public void WhenInitialized_SubmitButtonText_IsEmpty() => Assert.Equal(string.Empty, viewModel.SubmitButtonText); + + [Fact] + public void WhenInitialized_UserNameOrEmailLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.UserNameOrEmailLabel); + + [Fact] + public void WhenInitialized_PasswordLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.PasswordLabel); + + [Fact] + public void WhenInitialized_StaySignedInLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.StaySignedInLabel); + + [Fact] + public void WhenInitialized_UserNameOrEmail_IsEmpty() => Assert.Equal(string.Empty, viewModel.UserNameOrEmail); + + [Fact] + public void WhenInitialized_Password_IsEmpty() => Assert.Equal(string.Empty, viewModel.Password); + + [Fact] + public void WhenInitialized_StaySignedIn_IsFalse() => Assert.False(viewModel.StaySignedIn); +} \ No newline at end of file diff --git a/src/TrainingGuides.Web.Tests/packages.lock.json b/src/TrainingGuides.Web.Tests/packages.lock.json index 93839eb2..8503ccd5 100644 --- a/src/TrainingGuides.Web.Tests/packages.lock.json +++ b/src/TrainingGuides.Web.Tests/packages.lock.json @@ -988,6 +988,7 @@ "dependencies": { "AspNetCore.Unobtrusive.Ajax": "[2.0.0, )", "Enums.NET": "[4.0.2, )", + "Htmx": "[1.8.0, )", "TrainingGuides.Admin": "[1.0.0, )", "TrainingGuides.Entities": "[1.0.0, )", "kentico.xperience.admin": "[29.6.1, )", @@ -1011,6 +1012,15 @@ "resolved": "4.0.2", "contentHash": "Nwa4XxZ7fsuh9SpMiLUXmFT+NntALGXEvufLaQT+A0bQUH5ToNTtG0QDCoCiChdhp+4F/rtwyxpoJSgDmObIXg==" }, + "Htmx": { + "type": "CentralTransitive", + "requested": "[1.8.0, )", + "resolved": "1.8.0", + "contentHash": "bdsdNw8RWcj8HmoD9qmVHDf9F/xbN9ac3xsHu8dMekj2jLQFzu6sQiry4cE7Od7rokgL819qW9gNOUkee1Hgfg==", + "dependencies": { + "System.Text.Json": "6.0.5" + } + }, "Kentico.Xperience.Admin": { "type": "CentralTransitive", "requested": "[29.6.1, )", diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs new file mode 100644 index 00000000..a8aa2fc8 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -0,0 +1,84 @@ +using System.Web; +using CMS.Core; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Membership.Widgets.Authentication; +using SignInResult = Microsoft.AspNetCore.Identity.SignInResult; +using Htmx; +using TrainingGuides.Web.Features.Membership.Services; + + +namespace TrainingGuides.Web.Features.Membership.Controllers; + +[Route("[controller]/[action]")] +public class AccountController : Controller +{ + private readonly IEventLogService eventLogService; + private readonly IMembershipService membershipService; + private readonly SignInManager signInManager; + + public AccountController( + IMembershipService membershipService, + SignInManager signInManager, + IEventLogService eventLogService) + { + this.membershipService = membershipService; + this.signInManager = signInManager; + this.eventLogService = eventLogService; + } + + [HttpPost] + [AllowAnonymous] + [ValidateAntiForgeryToken] + public async Task SignIn(SignInWidgetViewModel model, string returnUrl) + { + if (!ModelState.IsValid) + { + return PartialView("~/Features/Widgets/Authentication/SignInForm.cshtml", model); + } + + var signInResult = SignInResult.Failed; + try + { + var member = await membershipService.GetMemberByUserNameOrEmail(model.UserNameOrEmail); + + signInResult = member is null + ? SignInResult.Failed + : await signInManager.PasswordSignInAsync(member.UserName!, model.Password, model.StaySignedIn, false); + } + catch (Exception ex) + { + eventLogService.LogException(nameof(AuthenticationController), nameof(SignIn), ex); + + signInResult = SignInResult.Failed; + } + + if (!signInResult.Succeeded) + { + ModelState.AddModelError(string.Empty, "Your sign-in attempt was not successful. Please try again."); + + return PartialView("~/Features/Widgets/Authentication/SignInForm.cshtml", model); + } + + string decodedReturnUrl = HttpUtility.UrlDecode(returnUrl) ?? ""; + + string redirectUrl = $"{Request.PathBase}/home"; + + Response.Htmx(h => h.Redirect(redirectUrl)); + + return Request.IsHtmx() + ? Ok() + : Redirect(redirectUrl); + } + + [Authorize] + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Logout() + { + await signInManager.SignOutAsync(); + + return Redirect($"{Request.PathBase}/profile"); + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs similarity index 83% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs rename to src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 996087cd..8b47949e 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -2,11 +2,10 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; -using TrainingGuides.Admin; -using TrainingGuides.Web.Features.Membership; using TrainingGuides.Web.Features.Membership.Services; -public class RegistrationController(IMembershipService membershipService, IEventLogService log, IStringLocalizer localizer) : Controller +namespace TrainingGuides.Web.Features.Membership.Controllers; +public class AuthenticationController(IMembershipService membershipService, IEventLogService log, IStringLocalizer localizer) : Controller { [HttpPost("/Registration/Register")] @@ -34,7 +33,7 @@ public async Task Register(RegistrationWidgetViewModel model) } catch (Exception ex) { - log.LogException(nameof(RegistrationController), nameof(Register), ex); + log.LogException(nameof(AuthenticationController), nameof(Register), ex); result = IdentityResult.Failed([new() { Code = "Failure", Description = localizer["Registration failed."] }]); } } diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 2009d41c..9be68f4b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -3,7 +3,8 @@ namespace TrainingGuides.Web.Features.Membership.Services; public interface IMembershipService { - public Task GetMember(); + public Task GetCurrentMember(); public Task IsMemberAuthenticated(); public Task CreateMember(GuidesMember member, string password); + public Task GetMemberByUserNameOrEmail(string userNameOrEmail); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 92e596b9..cd72bf60 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -13,7 +13,7 @@ public MembershipService( this.contextAccessor = contextAccessor; } - public async Task GetMember() + public async Task GetCurrentMember() { var context = contextAccessor.HttpContext; if (context is null) @@ -25,9 +25,12 @@ public MembershipService( } public async Task IsMemberAuthenticated() { - var member = await GetMember(); + var member = await GetCurrentMember(); return member is not null; } public async Task CreateMember(GuidesMember member, string password) => await userManager.CreateAsync(member, password); + + public async Task GetMemberByUserNameOrEmail(string userNameOrEmail) => + await userManager.FindByNameAsync(userNameOrEmail) ?? await userManager.FindByEmailAsync(userNameOrEmail); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs deleted file mode 100644 index eb41f69f..00000000 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInViewModel.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using TrainingGuides.Web.Features.Membership.Widgets.Authentication; - -namespace TrainingGuides.Web.Features.Widgets.Authentication; - -public class SignInViewModel -{ - [Required(ErrorMessage = "Please enter your user name or email address")] - [MaxLength(100, ErrorMessage = "Maximum allowed length of the input text is {1}")] - public string UserNameOrEmail { get; set; } = string.Empty; - - [DataType(DataType.Password)] - [MaxLength(100, ErrorMessage = "Maximum allowed length of the input text is {1}")] - public string Password { get; set; } = string.Empty; - - public bool StaySignedIn { get; set; } = false; - - public SignInWidgetViewModel Labels { get; set; } = new(); -} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml similarity index 77% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInForm.cshtml rename to src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index 3fe10a18..5d650be4 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -1,5 +1,6 @@ -@using TrainingGuides.Web.Features.Widgets.Authentication -@model SignInViewModel +@using TrainingGuides.Web.Features.Membership.Widgets.Authentication + +@model SignInWidgetViewModel
@@ -8,7 +9,7 @@
- +
@@ -18,7 +19,7 @@
- +
@@ -28,7 +29,7 @@
- +
- + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml similarity index 100% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidget.cshtml rename to src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs similarity index 100% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetProperties.cs rename to src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs similarity index 89% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewComponent.cs rename to src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs index 7c02dacd..12338fe5 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs @@ -3,7 +3,6 @@ using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.Authentication; using TrainingGuides.Web.Features.Shared.Services; -using TrainingGuides.Web.Features.Widgets.Authentication; [assembly: RegisterWidget( identifier: SignInWidgetViewComponent.IDENTIFIER, @@ -11,7 +10,7 @@ name: "SignIn", propertiesType: typeof(SignInWidgetProperties), Description = "Displays a sign in form for members.", - IconClass = "icon-lines-rectangle-o")] + IconClass = "icon-user")] namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; public class SignInWidgetViewComponent : ViewComponent @@ -41,10 +40,7 @@ public async Task InvokeAsync(SignInWidgetProperties prope StaySignedInLabel = properties.StaySignedInLabel }; - return View("~/Features/Membership/Widgets/Authentication/AuthenticationWidget.cshtml", new SignInViewModel - { - Labels = widgetViewModel - }); + return View("~/Features/Membership/Widgets/Authentication/SignInWidget.cshtml", widgetViewModel); } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs similarity index 56% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewModel.cs rename to src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index 8fb9bd48..618920d8 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Authentication/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -1,39 +1,65 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; + namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; public class SignInWidgetViewModel { + //WIDGET DISPLAY PROPERTIES + /// /// The Base URL of the site /// + [HiddenInput] public string BaseUrl { get; set; } = string.Empty; /// - /// The Base URL of the site + /// Determines whether the widget should display the form. E.g., if the user is already authenticated, the form should not be displayed. Instead they should see a sign out button /// + [HiddenInput] public bool DisplayForm { get; set; } = true; /// /// Form title /// + [HiddenInput] public string FormTitle { get; set; } = string.Empty; /// /// Submit button text /// + [HiddenInput] public string SubmitButtonText { get; set; } = string.Empty; /// /// User name or email label. /// + [HiddenInput] public string UserNameOrEmailLabel { get; set; } = string.Empty; /// /// Password label. /// + [HiddenInput] public string PasswordLabel { get; set; } = string.Empty; /// /// Stay signed in label. /// + [HiddenInput] public string StaySignedInLabel { get; set; } = string.Empty; + + //FORM PROPERTIES + + [DataType(DataType.Text)] + [Required()] + [MaxLength(100)] + public string UserNameOrEmail { get; set; } = string.Empty; + + [DataType(DataType.Password)] + [Required()] + [MaxLength(100)] + public string Password { get; set; } = string.Empty; + + public bool StaySignedIn { get; set; } = false; } diff --git a/src/TrainingGuides.Web/TrainingGuides.Web.csproj b/src/TrainingGuides.Web/TrainingGuides.Web.csproj index f54bb5f7..956b0d1e 100644 --- a/src/TrainingGuides.Web/TrainingGuides.Web.csproj +++ b/src/TrainingGuides.Web/TrainingGuides.Web.csproj @@ -3,6 +3,7 @@ + diff --git a/src/TrainingGuides.Web/packages.lock.json b/src/TrainingGuides.Web/packages.lock.json index 6d8d5511..0dad5591 100644 --- a/src/TrainingGuides.Web/packages.lock.json +++ b/src/TrainingGuides.Web/packages.lock.json @@ -17,6 +17,15 @@ "resolved": "4.0.2", "contentHash": "Nwa4XxZ7fsuh9SpMiLUXmFT+NntALGXEvufLaQT+A0bQUH5ToNTtG0QDCoCiChdhp+4F/rtwyxpoJSgDmObIXg==" }, + "Htmx": { + "type": "Direct", + "requested": "[1.8.0, )", + "resolved": "1.8.0", + "contentHash": "bdsdNw8RWcj8HmoD9qmVHDf9F/xbN9ac3xsHu8dMekj2jLQFzu6sQiry4cE7Od7rokgL819qW9gNOUkee1Hgfg==", + "dependencies": { + "System.Text.Json": "6.0.5" + } + }, "Kentico.Xperience.Admin": { "type": "Direct", "requested": "[29.6.1, )", From b70af57e6ba19cb1a1f1382550f28c913fa9c71d Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 14:46:11 -0500 Subject: [PATCH 13/60] GH-86 :: add link/sign out widget, move registration controller, add auth check to registration view component --- .../RegistrationController.cs | 4 +- .../LinkOrSignOut/LinkOrSignOutWidget.cshtml | 37 ++++ .../LinkOrSignOutWidgetProperties.cs | 39 +++++ .../LinkOrSignOutWidgetViewComponent.cs | 85 ++++++++++ .../LinkOrSignOutWidgetViewModel.cs | 10 ++ .../Widgets/LinkOrSignOut/SignOutForm.cshtml | 8 + .../Widgets/LinkOrSignOut/SignOutFormModel.cs | 10 ++ .../Registration/RegistrationForm.cshtml | 159 +++++++++--------- .../Registration/RegistrationWidget.cshtml | 1 + .../RegistrationWidgetProperties.cs | 12 ++ .../RegistrationWidgetViewComponent.cs | 9 +- 11 files changed, 288 insertions(+), 86 deletions(-) rename src/TrainingGuides.Web/Features/Membership/{Widgets/Registration => Controllers}/RegistrationController.cs (96%) create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutFormModel.cs diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs similarity index 96% rename from src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs rename to src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 996087cd..61a501bb 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -2,10 +2,10 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; -using TrainingGuides.Admin; -using TrainingGuides.Web.Features.Membership; using TrainingGuides.Web.Features.Membership.Services; +namespace TrainingGuides.Web.Features.Membership.Controllers; + public class RegistrationController(IMembershipService membershipService, IEventLogService log, IStringLocalizer localizer) : Controller { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml new file mode 100644 index 00000000..e6676af6 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml @@ -0,0 +1,37 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; +@model LinkOrSignOutWidgetViewModel + +@if (Model == null || string.IsNullOrWhiteSpace(Model.ButtonText) || string.IsNullOrWhiteSpace(Model.Url)) +{ + + + + + return; +} + +@if (Model != null) +{ +
+
+ @Model.Text +
+
+ @if (Model.IsAuthenticated) + { + var signOutFormModel = new SignOutFormModel + { + RedirectUrl = Model.Url, + ButtonText = Model.ButtonText + }; + + } + else + { + + @Model.Text + + } +
+
+} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs new file mode 100644 index 00000000..f4151ddc --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs @@ -0,0 +1,39 @@ +using Kentico.PageBuilder.Web.Mvc; +using Kentico.Xperience.Admin.Base.FormAnnotations; +using Kentico.Xperience.Admin.Websites.FormAnnotations; + +namespace TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; + +public class LinkOrSignOutWidgetProperties : IWidgetProperties +{ + [TextInputComponent( + Label = "Unauthenticated text", + ExplanationText = "Text to display when the visitor is not authenticated.", + Order = 10)] + public string UnauthenticatedText { get; set; } = string.Empty; + + [TextInputComponent( + Label = "Unauthenticated link text", + ExplanationText = "Text for the link button when the visitor is not authenticated.", + Order = 20)] + public string UnauthenticatedButtonText { get; set; } = string.Empty; + + [WebPageSelectorComponent( + Label = "Unauthenticated link target page", + ExplanationText = "Page to link to when the visitor is not authenticated.", + MaximumPages = 1, + Order = 30)] + public IEnumerable UnauthenticatedTargetContentPage { get; set; } = Enumerable.Empty(); + + [TextInputComponent( + Label = "Authenticated text", + ExplanationText = "Text to display when the visitor is authenticated.", + Order = 40)] + public string AuthenticatedText { get; set; } = string.Empty; + + [TextInputComponent( + Label = "Authenticated text", + ExplanationText = "Text for the 'Sign out' link button when the visitor is authenticated.", + Order = 40)] + public string AuthenticatedButtonText { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs new file mode 100644 index 00000000..4f7e1879 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs @@ -0,0 +1,85 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ViewComponents; +using Kentico.Content.Web.Mvc.Routing; +using Kentico.PageBuilder.Web.Mvc; +using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; +using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Shared.Services; + +[assembly: + RegisterWidget( + identifier: LinkOrSignOutWidgetViewComponent.IDENTIFIER, + viewComponentType: typeof(LinkOrSignOutWidgetViewComponent), + name: "Link or Sign Out", + propertiesType: typeof(LinkOrSignOutWidgetProperties), + Description = $"Displays a line of text and a link button that will log out a member if they are authenticated and link to a specified page (such as Sign-in or Registration) if not.", + IconClass = "icon-bubble")] + +namespace TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; + +public class LinkOrSignOutWidgetViewComponent : ViewComponent +{ + public const string IDENTIFIER = "TrainingGuides.LinkOrSignOutWidget"; + + private readonly IWebPageUrlRetriever webPageUrlRetriever; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; + private readonly IMembershipService membershipService; + private readonly IHttpRequestService httpRequestService; + + public LinkOrSignOutWidgetViewComponent( + IWebPageUrlRetriever webPageUrlRetriever, + IPreferredLanguageRetriever preferredLanguageRetriever, + IMembershipService membershipService, + IHttpRequestService httpRequestService) + { + this.webPageUrlRetriever = webPageUrlRetriever; + this.preferredLanguageRetriever = preferredLanguageRetriever; + this.membershipService = membershipService; + this.httpRequestService = httpRequestService; + } + + public async Task InvokeAsync(LinkOrSignOutWidgetProperties properties) + { + bool isAuthenticated = await membershipService.IsMemberAuthenticated(); + + string preferredLanguageCode = preferredLanguageRetriever.Get(); + + LinkOrSignOutWidgetViewModel model; + + if (isAuthenticated) + { + string baseUrl = httpRequestService.GetBaseUrl(); + string CurrentPageUrl = await httpRequestService.GetCurrentPageUrlForLanguage(preferredLanguageCode); + + model = new LinkOrSignOutWidgetViewModel() + { + Text = properties.AuthenticatedText, + ButtonText = properties.AuthenticatedButtonText, + Url = $"{baseUrl}/Membership/SignOut", + RedirectUrl = string.IsNullOrWhiteSpace(CurrentPageUrl) ? baseUrl : CurrentPageUrl, + IsAuthenticated = isAuthenticated, + }; + } + else + { + string linkTargetUrl = await GetWebPageUrl(properties.UnauthenticatedTargetContentPage?.FirstOrDefault(), preferredLanguageCode) + ?? string.Empty; + + model = new LinkOrSignOutWidgetViewModel() + { + Text = properties.UnauthenticatedText, + ButtonText = properties.UnauthenticatedButtonText, + Url = linkTargetUrl, + IsAuthenticated = isAuthenticated, + }; + } + + return View("~/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml", model); + } + + private async Task GetWebPageUrl(WebPageRelatedItem? webPage, string preferredLanguageCode) => + webPage != null + ? (await webPageUrlRetriever.Retrieve(webPage.WebPageGuid, preferredLanguageCode)) + .RelativePath + : string.Empty; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs new file mode 100644 index 00000000..e40b30c3 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs @@ -0,0 +1,10 @@ +namespace TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; + +public class LinkOrSignOutWidgetViewModel +{ + public string Text { get; set; } = string.Empty; + public string ButtonText { get; set; } = string.Empty; + public string Url { get; set; } = string.Empty; + public string RedirectUrl { get; set; } = string.Empty; + public bool IsAuthenticated { get; set; } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml new file mode 100644 index 00000000..e0e6f90b --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml @@ -0,0 +1,8 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut +@model SignOutFormModel + +
+ + +
diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutFormModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutFormModel.cs new file mode 100644 index 00000000..31d5c360 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutFormModel.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc; + +namespace TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; + +public class SignOutFormModel +{ + [HiddenInput] + public string RedirectUrl { get; set; } = string.Empty; + public string ButtonText { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml index 6f04dfc6..a37b7eff 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml @@ -1,109 +1,106 @@ @model RegistrationWidgetViewModel -
-
-
+
+
- @* Include hidden inputs for widget display and links. - If server-side validation fails, these values will allow the form to be properly re-rendered. *@ - - - - - - - - - - - - - - + @* Include hidden inputs for widget display and links. + If server-side validation fails, these values will allow the form to be properly re-rendered. *@ + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ @if (Model.ShowName) + {
- +
- - + +
+
- +
- - + +
+
- +
- - + +
- + } + @if (Model.ShowExtraFields) + {
- +
- - + +
- @if (Model.ShowName) - { -
-
- -
-
- - -
-
+ } + -
-
- -
-
- - -
-
- -
-
- -
-
- - -
-
- } - @if (Model.ShowExtraFields) - { -
-
- -
-
- - -
-
- } - - - -
- \ No newline at end of file + +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index d9d74a53..cf33a0c1 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -3,6 +3,7 @@ @model RegistrationWidgetViewModel @{ + // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. var formDivId = $"registerForm{Guid.NewGuid()}"; } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs index 978cf535..0a3306a6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetProperties.cs @@ -10,6 +10,7 @@ public class RegistrationWidgetProperties : IWidgetProperties ///
[CheckBoxComponent( Label = "Show name", + ExplanationText = "Checkbox that determines if the registration form should display given name and family name fields.", Order = 10)] public bool ShowName { get; set; } = true; @@ -18,6 +19,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [CheckBoxComponent( Label = "Show extra fields", + ExplanationText = "Checkbox that determines if the registration form should display extra fields.", Order = 20)] public bool ShowExtraFields { get; set; } = true; @@ -26,6 +28,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Form title", + ExplanationText = "Title to display above the registration form.", Order = 30)] public string FormTitle { get; set; } = "Sign up"; @@ -34,6 +37,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Submit button text", + ExplanationText = "Text for the button that submits the registration form.", Order = 40)] public string SubmitButtonText { get; set; } = "Submit"; @@ -42,6 +46,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "User name label", + ExplanationText = "Label for the text box where registrants can input their UserName.", Order = 50)] public string UserNameLabel { get; set; } = "User name"; @@ -50,6 +55,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Email address label", + ExplanationText = "Label for the text box where registrants can input their email address.", Order = 60)] public string EmailAddressLabel { get; set; } = "Email address"; @@ -58,6 +64,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Password label", + ExplanationText = "Label for the text box where registrants can input their password.", Order = 70)] public string PasswordLabel { get; set; } = "Password"; @@ -66,6 +73,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Confirm password label", + ExplanationText = "Label for the text box where registrants can confirm their password.", Order = 80)] public string ConfirmPasswordLabel { get; set; } = "Confirm your password"; @@ -74,6 +82,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Given name label", + ExplanationText = "Label for the text box where registrants can input their given name.", Order = 90)] public string GivenNameLabel { get; set; } = "Given name"; @@ -82,6 +91,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Family name label", + ExplanationText = "Label for the text box where registrants can input their family name.", Order = 100)] public string FamilyNameLabel { get; set; } = "Family name"; @@ -90,6 +100,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "'Family name first' checkbox label", + ExplanationText = "Label for the checkbox that indicates whether the family name comes before the given name.", Order = 110)] public string FamilyNameFirstLabel { get; set; } = "Family name goes first"; @@ -98,6 +109,7 @@ public class RegistrationWidgetProperties : IWidgetProperties /// [TextInputComponent( Label = "Favorite coffee label", + ExplanationText = "Label for the text box where registrants can input their favorite coffee.", Order = 120)] public string FavoriteCoffeeLabel { get; set; } = "Favorite coffee"; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs index e7c1dc14..e29e047a 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -2,6 +2,7 @@ using Kentico.PageBuilder.Web.Mvc; using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.Registration; using TrainingGuides.Web.Features.Shared.Services; @@ -19,19 +20,21 @@ namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; public class RegistrationWidgetViewComponent : ViewComponent { private readonly IHttpRequestService httpRequestService; + private readonly IMembershipService membershipService; public const string IDENTIFIER = "TrainingGuides.RegistrationWidget"; - public RegistrationWidgetViewComponent(IHttpRequestService httpRequestService) + public RegistrationWidgetViewComponent(IHttpRequestService httpRequestService, IMembershipService membershipService) { this.httpRequestService = httpRequestService; + this.membershipService = membershipService; } - public IViewComponentResult Invoke(RegistrationWidgetProperties properties) + public async Task InvokeAsync(RegistrationWidgetProperties properties) { var registerModel = new RegistrationWidgetViewModel { BaseUrl = httpRequestService.GetBaseUrl(), - DisplayForm = true, //TODO add service method to check if member is currently signed in/out + DisplayForm = await membershipService.IsMemberAuthenticated(), ShowName = properties.ShowName, ShowExtraFields = properties.ShowExtraFields, FormTitle = properties.FormTitle, From 86c1ef639622f7c144862d687ac9a8fe59638fba Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 12 Nov 2024 15:32:35 -0500 Subject: [PATCH 14/60] GH-89 :: extract sign in logic into the Membership service --- .../Controllers/AuthenticationController.cs | 42 ++----------------- .../Membership/Services/IMembershipService.cs | 2 +- .../Membership/Services/MembershipService.cs | 32 +++++++++++++- 3 files changed, 35 insertions(+), 41 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index a8aa2fc8..99225101 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -1,31 +1,21 @@ using System.Web; -using CMS.Core; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using TrainingGuides.Web.Features.Membership.Widgets.Authentication; -using SignInResult = Microsoft.AspNetCore.Identity.SignInResult; +using CMS.Core; using Htmx; using TrainingGuides.Web.Features.Membership.Services; - +using TrainingGuides.Web.Features.Membership.Widgets.Authentication; namespace TrainingGuides.Web.Features.Membership.Controllers; [Route("[controller]/[action]")] public class AccountController : Controller { - private readonly IEventLogService eventLogService; private readonly IMembershipService membershipService; - private readonly SignInManager signInManager; - public AccountController( - IMembershipService membershipService, - SignInManager signInManager, - IEventLogService eventLogService) + public AccountController(IMembershipService membershipService) { this.membershipService = membershipService; - this.signInManager = signInManager; - this.eventLogService = eventLogService; } [HttpPost] @@ -38,21 +28,7 @@ public async Task SignIn(SignInWidgetViewModel model, string retu return PartialView("~/Features/Widgets/Authentication/SignInForm.cshtml", model); } - var signInResult = SignInResult.Failed; - try - { - var member = await membershipService.GetMemberByUserNameOrEmail(model.UserNameOrEmail); - - signInResult = member is null - ? SignInResult.Failed - : await signInManager.PasswordSignInAsync(member.UserName!, model.Password, model.StaySignedIn, false); - } - catch (Exception ex) - { - eventLogService.LogException(nameof(AuthenticationController), nameof(SignIn), ex); - - signInResult = SignInResult.Failed; - } + var signInResult = await membershipService.SignIn(model.UserNameOrEmail, model.Password, model.StaySignedIn); if (!signInResult.Succeeded) { @@ -71,14 +47,4 @@ public async Task SignIn(SignInWidgetViewModel model, string retu ? Ok() : Redirect(redirectUrl); } - - [Authorize] - [HttpPost] - [ValidateAntiForgeryToken] - public async Task Logout() - { - await signInManager.SignOutAsync(); - - return Redirect($"{Request.PathBase}/profile"); - } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 9be68f4b..d15a9588 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -6,5 +6,5 @@ public interface IMembershipService public Task GetCurrentMember(); public Task IsMemberAuthenticated(); public Task CreateMember(GuidesMember member, string password); - public Task GetMemberByUserNameOrEmail(string userNameOrEmail); + public Task SignIn(string userNameOrEmail, string password, bool staySignedIn); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index cd72bf60..f56604df 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -1,16 +1,25 @@ +using CMS.Core; using Microsoft.AspNetCore.Identity; +using TrainingGuides.Web.Features.Membership.Controllers; namespace TrainingGuides.Web.Features.Membership.Services; public class MembershipService : IMembershipService { private readonly UserManager userManager; + private readonly SignInManager signInManager; private readonly IHttpContextAccessor contextAccessor; + private readonly IEventLogService eventLogService; + public MembershipService( UserManager userManager, - IHttpContextAccessor contextAccessor) + SignInManager signInManager, + IHttpContextAccessor contextAccessor, + IEventLogService eventLogService) { this.userManager = userManager; + this.signInManager = signInManager; this.contextAccessor = contextAccessor; + this.eventLogService = eventLogService; } public async Task GetCurrentMember() @@ -31,6 +40,25 @@ public async Task IsMemberAuthenticated() public async Task CreateMember(GuidesMember member, string password) => await userManager.CreateAsync(member, password); - public async Task GetMemberByUserNameOrEmail(string userNameOrEmail) => + private async Task GetMemberByUserNameOrEmail(string userNameOrEmail) => await userManager.FindByNameAsync(userNameOrEmail) ?? await userManager.FindByEmailAsync(userNameOrEmail); + + public async Task SignIn(string userNameOrEmail, string password, bool staySignedIn) + { + try + { + var member = await GetMemberByUserNameOrEmail(userNameOrEmail); + if (member is null) + { + return SignInResult.Failed; + } + + return await signInManager.PasswordSignInAsync(member.UserName!, password, staySignedIn, false); + } + catch (Exception ex) + { + eventLogService.LogException(nameof(AuthenticationController), nameof(SignIn), ex); + return SignInResult.Failed; + } + } } \ No newline at end of file From 0074b137585014732def82f9c1ff87eeb466e94c Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 15:58:24 -0500 Subject: [PATCH 15/60] GH-86 :: add sign out functionality --- .../Membership/Controllers/AuthenticationController.cs | 10 ++++++++++ .../Features/Membership/Services/IMembershipService.cs | 1 + .../Features/Membership/Services/MembershipService.cs | 5 +++-- .../LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs | 3 +-- .../LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs | 1 - .../Widgets/LinkOrSignOut/SignOutForm.cshtml | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 99225101..59cbe21f 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -5,6 +5,7 @@ using Htmx; using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.Authentication; +using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; namespace TrainingGuides.Web.Features.Membership.Controllers; @@ -47,4 +48,13 @@ public async Task SignIn(SignInWidgetViewModel model, string retu ? Ok() : Redirect(redirectUrl); } + + [Authorize] + [HttpPost("/Account/Logout")] + [ValidateAntiForgeryToken] + public async Task Logout(SignOutFormModel model) + { + await membershipService.SignOut(); + return Redirect(model.RedirectUrl); + } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index d15a9588..9ab462ce 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -7,4 +7,5 @@ public interface IMembershipService public Task IsMemberAuthenticated(); public Task CreateMember(GuidesMember member, string password); public Task SignIn(string userNameOrEmail, string password, bool staySignedIn); + public Task SignOut(); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index f56604df..6130d1b6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -1,6 +1,5 @@ using CMS.Core; using Microsoft.AspNetCore.Identity; -using TrainingGuides.Web.Features.Membership.Controllers; namespace TrainingGuides.Web.Features.Membership.Services; public class MembershipService : IMembershipService @@ -57,8 +56,10 @@ public async Task SignIn(string userNameOrEmail, string password, } catch (Exception ex) { - eventLogService.LogException(nameof(AuthenticationController), nameof(SignIn), ex); + eventLogService.LogException(nameof(MembershipService), nameof(SignIn), ex); return SignInResult.Failed; } } + + public async Task SignOut() => await signInManager.SignOutAsync(); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs index 4f7e1879..ae74842a 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs @@ -55,8 +55,7 @@ public async Task InvokeAsync(LinkOrSignOutWidgetProper { Text = properties.AuthenticatedText, ButtonText = properties.AuthenticatedButtonText, - Url = $"{baseUrl}/Membership/SignOut", - RedirectUrl = string.IsNullOrWhiteSpace(CurrentPageUrl) ? baseUrl : CurrentPageUrl, + Url = string.IsNullOrWhiteSpace(CurrentPageUrl) ? baseUrl : CurrentPageUrl, IsAuthenticated = isAuthenticated, }; } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs index e40b30c3..c5b0bfd0 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs @@ -5,6 +5,5 @@ public class LinkOrSignOutWidgetViewModel public string Text { get; set; } = string.Empty; public string ButtonText { get; set; } = string.Empty; public string Url { get; set; } = string.Empty; - public string RedirectUrl { get; set; } = string.Empty; public bool IsAuthenticated { get; set; } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml index e0e6f90b..d4a20756 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml @@ -1,7 +1,7 @@ @using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut @model SignOutFormModel -
From 0519b6db5b33881282fc0eae7248c0648cf496f5 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 15:58:40 -0500 Subject: [PATCH 16/60] GH-86 :: add widget configuration validation --- .../Registration/RegistrationWidget.cshtml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index cf33a0c1..0bf4604d 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -5,6 +5,25 @@ @{ // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. var formDivId = $"registerForm{Guid.NewGuid()}"; + + bool isMisconfigured = Model == null + || string.IsNullOrWhiteSpace(Model.BaseUrl) + || string.IsNullOrWhiteSpace(Model.SubmitButtonText) + || string.IsNullOrWhiteSpace(Model.UserNameLabel) + || string.IsNullOrWhiteSpace(Model.EmailAddressLabel) + || string.IsNullOrWhiteSpace(Model.PasswordLabel) + || string.IsNullOrWhiteSpace(Model.ConfirmPasswordLabel) + || (Model.ShowName && (string.IsNullOrWhiteSpace(Model.GivenNameLabel) || string.IsNullOrWhiteSpace(Model.FamilyNameLabel) || string.IsNullOrWhiteSpace(Model.FamilyNameFirstLabel))) + || (Model.ShowExtraFields && string.IsNullOrWhiteSpace(Model.FavoriteCoffeeLabel)); +} + +@if (isMisconfigured) +{ + + + + + return; }

@Model.FormTitle

From 21869a827d2f88164d36fdb61b6636f4b7655df1 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 12 Nov 2024 16:40:16 -0500 Subject: [PATCH 17/60] GH-86 :: add registration page, enable non-required strings in form, fix button issue in sign out widget --- .../cms.contentitem/register-wfb2l0pn.xml | 17 ++++++++++ ...d-4fbb-84e2-b146431792ab_en@8cb2345696.xml | 24 ++++++++++++++ ...d-4066-8dd3-dd9400b46936_en@3e3bd9acfd.xml | 28 +++++++++++++++++ .../cms.webpageitem/contact_us@3a24980ea3.xml | 2 +- .../cookie_policy@fdaf70dc83.xml | 2 +- .../cms.webpageitem/home@0b99586e43.xml | 2 +- .../cms.webpageitem/news@8a4426a4c0.xml | 2 +- .../policy_downloads@fb51445f65.xml | 2 +- .../cms.webpageitem/products@e200480d67.xml | 2 +- .../cms.webpageitem/register@e129551b80.xml | 21 +++++++++++++ .../widget_samples@8227dadc40.xml | 2 +- .../es_register_es@7bbc9f7e2a.xml | 31 +++++++++++++++++++ .../register_en@213bf2db9c.xml | 31 +++++++++++++++++++ .../3fe5884c-bc6d-440b-8910-fa0e342293d8.xml | 13 ++++++++ .../LinkOrSignOut/LinkOrSignOutWidget.cshtml | 2 +- src/TrainingGuides.Web/Program.cs | 2 +- 16 files changed, 174 insertions(+), 9 deletions(-) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/register-wfb2l0pn.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/f6894ac4-cf7d-4066-8dd3-dd9400b46936_en@3e3bd9acfd.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_register_es@7bbc9f7e2a.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/register_en@213bf2db9c.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e2-b146431792ab_en@df11369507/3fe5884c-bc6d-440b-8910-fa0e342293d8.xml diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/register-wfb2l0pn.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/register-wfb2l0pn.xml new file mode 100644 index 00000000..44d8b53a --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/register-wfb2l0pn.xml @@ -0,0 +1,17 @@ + + + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + TrainingGuides.EmptyPage + 58018c9d-5b6c-4251-b3a8-8c1a6d124780 + cms.contenttype + + 67f3dec8-3741-4570-9adb-399a61f47569 + False + False + Register-wfb2l0pn + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml new file mode 100644 index 00000000..154d7be2 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml @@ -0,0 +1,24 @@ + + + + Register-wfb2l0pn + 67f3dec8-3741-4570-9adb-399a61f47569 + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + 2024-11-12 21:22:13Z + 720f4866-de8d-4fbb-84e2-b146431792ab + True + 2024-11-12 21:25:55Z + +


"},"fieldIdentifiers":{"content":"b5c0822e-47b2-45ad-bb41-6c8aff165cd3"}}]},{"identifier":"1c125c5a-9016-4e68-bd9d-e09b2d001c3d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fabf2b85-2b37-4c1e-92b3-a718b57581c6","properties":{"unauthenticatedText":"Already have an account?","unauthenticatedButtonText":"Sign in here","unauthenticatedTargetContentPage":[{"webPageGuid":"377ca7c4-eea9-49a0-9d58-282b5127c7ff"}],"authenticatedText":"Sign out","authenticatedButtonText":"You are already registered."},"fieldIdentifiers":{"unauthenticatedText":"466b3cbc-8dee-4b03-ae78-4b11346248f0","unauthenticatedButtonText":"0b8b7c48-efb9-4288-a81e-13a805bb34d3","unauthenticatedTargetContentPage":"3ac28b30-e714-45ec-a8c7-e35778dd8469","authenticatedText":"cd9699ae-fd9f-471f-8520-9a00965002db","authenticatedButtonText":"82514014-d110-4c54-8523-9e0274984af0"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9521150d-c46a-4fa7-9313-1fdd4ed8c36c","colorScheme":"187c4225-712c-4f9f-88e0-f9986962bfea","cornerStyle":"6c91ad40-65be-4ece-89a8-b20898afd525","columnLayout":"b754983b-2cb9-4bad-a629-e768046b1114"}}]}]}]]> +
+ + + + 2 +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/f6894ac4-cf7d-4066-8dd3-dd9400b46936_en@3e3bd9acfd.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/f6894ac4-cf7d-4066-8dd3-dd9400b46936_en@3e3bd9acfd.xml new file mode 100644 index 00000000..5f59a1ae --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/f6894ac4-cf7d-4066-8dd3-dd9400b46936_en@3e3bd9acfd.xml @@ -0,0 +1,28 @@ + + + + Register-wfb2l0pn + 67f3dec8-3741-4570-9adb-399a61f47569 + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-12 21:22:08Z + Register + f6894ac4-cf7d-4066-8dd3-dd9400b46936 + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml index a16f75fb..5361361d 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml @@ -7,7 +7,7 @@ 4f7e84c7-329f-413e-83d9-5923a1011ccb ContactUs-2zqcdint - 6 + 8 /Contact_us fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml index 60def807..c4f77c88 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml @@ -7,7 +7,7 @@ 771d069e-e136-4a0f-880a-c0af6c8d2bdf CookiePolicy-gai183um - 7 + 9 /Cookie_policy fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml index b32c0bc3..745a6307 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml @@ -7,7 +7,7 @@ 377ca7c4-eea9-49a0-9d58-282b5127c7ff Home-ciuaqx9l - 1 + 3 /Home fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml index 1a9cc319..75ded986 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml @@ -7,7 +7,7 @@ 77c7aa1f-e0e3-4b74-a66f-8c0c87523c15 News-bgt05j82 - 4 + 6 /News fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml index 3f5f7d9f..fb06809c 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml @@ -7,7 +7,7 @@ 72a7df0f-c50e-42a9-a8d6-931688caca7d PolicyDownloads-jazqmswu - 5 + 7 /Policy_downloads fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml index 36f3f638..a159e886 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml @@ -7,7 +7,7 @@ 5a0c83e1-2ad8-40b2-aa00-d01980daf01d Products-oypi95ub - 2 + 4 /Products fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml new file mode 100644 index 00000000..74a727b7 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml @@ -0,0 +1,21 @@ + + + + Register-wfb2l0pn + 67f3dec8-3741-4570-9adb-399a61f47569 + cms.contentitem + + 9008b16a-3a70-41c9-92ba-2d289c940e2f + Register-wfb2l0pn + 11 + /Register + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml index 57bc42c8..18a2b22e 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml @@ -7,7 +7,7 @@ dc747040-b424-4f3d-9383-5f651b96415b WidgetSamples-qyagaxb2 - 8 + 10 /Widget_samples fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_register_es@7bbc9f7e2a.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_register_es@7bbc9f7e2a.xml new file mode 100644 index 00000000..e5c5692f --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_register_es@7bbc9f7e2a.xml @@ -0,0 +1,31 @@ + + + es/Register + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 265f57e1-a961-45e7-9119-867782ae0ea6 + + + + True + False + True + 0 + + Register-wfb2l0pn + 9008b16a-3a70-41c9-92ba-2d289c940e2f + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/register_en@213bf2db9c.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/register_en@213bf2db9c.xml new file mode 100644 index 00000000..3d16cc9d --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/register_en@213bf2db9c.xml @@ -0,0 +1,31 @@ + + + Register + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + f4a8cc70-29a4-48ac-b816-0d38abd62d5e + + + + True + False + True + 0 + + Register-wfb2l0pn + 9008b16a-3a70-41c9-92ba-2d289c940e2f + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e2-b146431792ab_en@df11369507/3fe5884c-bc6d-440b-8910-fa0e342293d8.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e2-b146431792ab_en@df11369507/3fe5884c-bc6d-440b-8910-fa0e342293d8.xml new file mode 100644 index 00000000..037905c0 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e2-b146431792ab_en@df11369507/3fe5884c-bc6d-440b-8910-fa0e342293d8.xml @@ -0,0 +1,13 @@ + + + + 720f4866-de8d-4fbb-84e2-b146431792ab + cms.contentitemcommondata + + Register-wfb2l0pn + 67f3dec8-3741-4570-9adb-399a61f47569 + cms.contentitem + + + 3fe5884c-bc6d-440b-8910-fa0e342293d8 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml index e6676af6..63f4a6d1 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml @@ -29,7 +29,7 @@ else { - @Model.Text + @Model.ButtonText } diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 3d2fba68..c3b62495 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -98,7 +98,7 @@ builder.Services.AddTrainingGuidesServices(); builder.Services.AddTrainingGuidesOptions(); -builder.Services.AddControllersWithViews(); +builder.Services.AddControllersWithViews( options => options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true); builder.Services.AddMvc().AddMvcLocalization(); builder.Services.AddDistributedMemoryCache(); From b53ef0c55b6fe89133c301a4b8301dfb8ec4b591 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 12 Nov 2024 20:31:43 -0500 Subject: [PATCH 18/60] GH-89 :: sign in form signs you in, but errors nor the redirect afterwards work --- .../cms.contentitem/signin-x4a1nygh.xml | 17 ++++++++++ ...4-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml | 24 ++++++++++++++ ...1-4c2e-93f3-24aed4355fcf_en@913b88a2da.xml | 28 +++++++++++++++++ .../cms.webpageitem/home@0b99586e43.xml | 2 +- .../cms.webpageitem/products@e200480d67.xml | 2 +- .../cms.webpageitem/sign_in@97331a9071.xml | 21 +++++++++++++ .../es_sign-in_es@620b1ab686.xml | 31 +++++++++++++++++++ .../sign-in_en@563583792b.xml | 31 +++++++++++++++++++ .../8302a5f3-dc27-480a-a6f0-5b993f280e75.xml | 13 ++++++++ .../Controllers/AuthenticationController.cs | 30 ++++++------------ .../Membership/Services/MembershipService.cs | 2 +- .../Widgets/SignIn/SignInWidget.cshtml | 29 ++++++++++------- .../SignIn/SignInWidgetViewComponent.cs | 6 ++-- src/TrainingGuides.Web/Program.cs | 2 +- 14 files changed, 198 insertions(+), 40 deletions(-) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/signin-x4a1nygh.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/13225c8b-04f1-4c2e-93f3-24aed4355fcf_en@913b88a2da.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_sign-in_es@620b1ab686.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/sign-in_en@563583792b.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_46..76-57c4fa27c1f7_en@1371cab611/8302a5f3-dc27-480a-a6f0-5b993f280e75.xml diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/signin-x4a1nygh.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/signin-x4a1nygh.xml new file mode 100644 index 00000000..cdb81ca8 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/signin-x4a1nygh.xml @@ -0,0 +1,17 @@ + + + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + TrainingGuides.EmptyPage + 58018c9d-5b6c-4251-b3a8-8c1a6d124780 + cms.contenttype + + 4f88daba-f579-43fb-acdd-d80c43d7317a + False + False + SignIn-x4a1nygh + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml new file mode 100644 index 00000000..14109f33 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml @@ -0,0 +1,24 @@ + + + + SignIn-x4a1nygh + 4f88daba-f579-43fb-acdd-d80c43d7317a + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + 2024-11-12 21:09:53Z + 46487f03-5214-475f-8a76-57c4fa27c1f7 + True + 2024-11-12 21:09:53Z + + + + + + + 2 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/13225c8b-04f1-4c2e-93f3-24aed4355fcf_en@913b88a2da.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/13225c8b-04f1-4c2e-93f3-24aed4355fcf_en@913b88a2da.xml new file mode 100644 index 00000000..82082828 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/13225c8b-04f1-4c2e-93f3-24aed4355fcf_en@913b88a2da.xml @@ -0,0 +1,28 @@ + + + + SignIn-x4a1nygh + 4f88daba-f579-43fb-acdd-d80c43d7317a + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-12 21:02:33Z + Sign in + 13225c8b-04f1-4c2e-93f3-24aed4355fcf + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml index 745a6307..b222c233 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml @@ -7,7 +7,7 @@ 377ca7c4-eea9-49a0-9d58-282b5127c7ff Home-ciuaqx9l - 3 + 2 /Home fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml index a159e886..0004ca23 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml @@ -7,7 +7,7 @@ 5a0c83e1-2ad8-40b2-aa00-d01980daf01d Products-oypi95ub - 4 + 3 /Products fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml new file mode 100644 index 00000000..6edf3d48 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml @@ -0,0 +1,21 @@ + + + + SignIn-x4a1nygh + 4f88daba-f579-43fb-acdd-d80c43d7317a + cms.contentitem + + 18fe09dc-c0f3-4136-863f-db59732e3658 + SignIn-x4a1nygh + 1 + /Sign_in + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_sign-in_es@620b1ab686.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_sign-in_es@620b1ab686.xml new file mode 100644 index 00000000..e1bbc6de --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_sign-in_es@620b1ab686.xml @@ -0,0 +1,31 @@ + + + es/Sign-in + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + a7bbb92d-4ea8-4d71-b99e-852098ccd504 + + + + True + False + True + 0 + + SignIn-x4a1nygh + 18fe09dc-c0f3-4136-863f-db59732e3658 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/sign-in_en@563583792b.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/sign-in_en@563583792b.xml new file mode 100644 index 00000000..e491b536 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/sign-in_en@563583792b.xml @@ -0,0 +1,31 @@ + + + Sign-in + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + 59486e9d-e407-46e7-9982-18162f98a38e + + + + True + False + True + 0 + + SignIn-x4a1nygh + 18fe09dc-c0f3-4136-863f-db59732e3658 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_46..76-57c4fa27c1f7_en@1371cab611/8302a5f3-dc27-480a-a6f0-5b993f280e75.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_46..76-57c4fa27c1f7_en@1371cab611/8302a5f3-dc27-480a-a6f0-5b993f280e75.xml new file mode 100644 index 00000000..5abd2383 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_46..76-57c4fa27c1f7_en@1371cab611/8302a5f3-dc27-480a-a6f0-5b993f280e75.xml @@ -0,0 +1,13 @@ + + + + 46487f03-5214-475f-8a76-57c4fa27c1f7 + cms.contentitemcommondata + + SignIn-x4a1nygh + 4f88daba-f579-43fb-acdd-d80c43d7317a + cms.contentitem + + + 8302a5f3-dc27-480a-a6f0-5b993f280e75 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 59cbe21f..90c305bc 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -1,32 +1,28 @@ -using System.Web; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using CMS.Core; -using Htmx; using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.Authentication; using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; namespace TrainingGuides.Web.Features.Membership.Controllers; -[Route("[controller]/[action]")] -public class AccountController : Controller +public class AuthenticationController : Controller { private readonly IMembershipService membershipService; - public AccountController(IMembershipService membershipService) + public AuthenticationController(IMembershipService membershipService) { this.membershipService = membershipService; } - [HttpPost] - [AllowAnonymous] + [HttpPost("/Authentication/Authenticate")] [ValidateAntiForgeryToken] - public async Task SignIn(SignInWidgetViewModel model, string returnUrl) + public async Task Authenticate(SignInWidgetViewModel model) { if (!ModelState.IsValid) { - return PartialView("~/Features/Widgets/Authentication/SignInForm.cshtml", model); + ModelState.AddModelError(string.Empty, "Your sign-in attempt was not successful. Please try again."); + return PartialView("~/Features/Membership/Widgets/Authentication/SignInForm.cshtml", model); } var signInResult = await membershipService.SignIn(model.UserNameOrEmail, model.Password, model.StaySignedIn); @@ -34,23 +30,15 @@ public async Task SignIn(SignInWidgetViewModel model, string retu if (!signInResult.Succeeded) { ModelState.AddModelError(string.Empty, "Your sign-in attempt was not successful. Please try again."); - - return PartialView("~/Features/Widgets/Authentication/SignInForm.cshtml", model); + return PartialView("~/Features/Membership/Widgets/Authentication/SignInForm.cshtml", model); } - string decodedReturnUrl = HttpUtility.UrlDecode(returnUrl) ?? ""; - string redirectUrl = $"{Request.PathBase}/home"; - - Response.Htmx(h => h.Redirect(redirectUrl)); - - return Request.IsHtmx() - ? Ok() - : Redirect(redirectUrl); + return Redirect(redirectUrl); } [Authorize] - [HttpPost("/Account/Logout")] + [HttpPost("/Authentication/Logout")] [ValidateAntiForgeryToken] public async Task Logout(SignOutFormModel model) { diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 6130d1b6..30738c2d 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -52,7 +52,7 @@ public async Task SignIn(string userNameOrEmail, string password, return SignInResult.Failed; } - return await signInManager.PasswordSignInAsync(member.UserName!, password, staySignedIn, false); + return await signInManager.PasswordSignInAsync(member.UserName, password, staySignedIn, false); } catch (Exception ex) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 8dabe1ae..8668cd78 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -2,16 +2,23 @@ @model SignInWidgetViewModel -@{ + +

@Model.FormTitle

+ +@if(Model.DisplayForm) +{ var formDivId = $"signInForm{Guid.NewGuid()}"; + @using (Html.AjaxBeginForm("Autheticate", "Authentication", new AjaxOptions + { + HttpMethod = "POST", + InsertionMode = InsertionMode.Replace, + UpdateTargetId = formDivId + }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) + { + + } +} +else +{ +

already signed in

} - -@using (Html.AjaxBeginForm("Autheticate", "Authentication", new AjaxOptions - { - HttpMethod = "POST", - InsertionMode = InsertionMode.Replace, - UpdateTargetId = formDivId - }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) - { - - } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs index 12338fe5..3c4b5f52 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs @@ -32,7 +32,7 @@ public async Task InvokeAsync(SignInWidgetProperties prope var widgetViewModel = new SignInWidgetViewModel { BaseUrl = httpRequestService.GetBaseUrl(), - DisplayForm = await membershipService.IsMemberAuthenticated(), + DisplayForm = !await membershipService.IsMemberAuthenticated(), FormTitle = properties.FormTitle, SubmitButtonText = properties.SubmitButtonText, UserNameOrEmailLabel = properties.UserNameLabel, @@ -40,8 +40,6 @@ public async Task InvokeAsync(SignInWidgetProperties prope StaySignedInLabel = properties.StaySignedInLabel }; - return View("~/Features/Membership/Widgets/Authentication/SignInWidget.cshtml", widgetViewModel); + return View("~/Features/Membership/Widgets/SignIn/SignInWidget.cshtml", widgetViewModel); } - - } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index c3b62495..32cfc813 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -81,7 +81,7 @@ builder.Services.AddIdentity(options => { - options.SignIn.RequireConfirmedAccount = true; + options.SignIn.RequireConfirmedAccount = false; options.User.RequireUniqueEmail = false;//change this once we add email functionality }) .AddUserStore>() From 53548cb391a8e7be63a84133cebd40024a29a54a Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 12 Nov 2024 21:27:09 -0500 Subject: [PATCH 19/60] GH-89 :: fix error rendering for sing-in --- .../Controllers/AuthenticationController.cs | 21 +++++--- .../Membership/Services/MembershipService.cs | 2 +- .../Widgets/SignIn/SignInForm.cshtml | 48 +++++++++++-------- .../Widgets/SignIn/SignInWidget.cshtml | 26 ++++++++-- .../Widgets/SignIn/SignInWidgetViewModel.cs | 2 +- 5 files changed, 67 insertions(+), 32 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 90c305bc..8c0a0913 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -6,35 +6,42 @@ namespace TrainingGuides.Web.Features.Membership.Controllers; + + public class AuthenticationController : Controller { private readonly IMembershipService membershipService; + private const string SIGN_IN_FAILED = "Your sign-in attempt was not successful. Please try again."; public AuthenticationController(IMembershipService membershipService) { this.membershipService = membershipService; } + private IActionResult RenderError(SignInWidgetViewModel model) + { + ModelState.AddModelError(string.Empty, SIGN_IN_FAILED); + return PartialView("~/Features/Membership/Widgets/SignIn/SignInForm.cshtml", model); + } + [HttpPost("/Authentication/Authenticate")] [ValidateAntiForgeryToken] public async Task Authenticate(SignInWidgetViewModel model) { if (!ModelState.IsValid) { - ModelState.AddModelError(string.Empty, "Your sign-in attempt was not successful. Please try again."); - return PartialView("~/Features/Membership/Widgets/Authentication/SignInForm.cshtml", model); + return RenderError(model); } var signInResult = await membershipService.SignIn(model.UserNameOrEmail, model.Password, model.StaySignedIn); - if (!signInResult.Succeeded) + if (signInResult.Succeeded) { - ModelState.AddModelError(string.Empty, "Your sign-in attempt was not successful. Please try again."); - return PartialView("~/Features/Membership/Widgets/Authentication/SignInForm.cshtml", model); + string redirectUrl = $"{model.BaseUrl}/home"; + return Redirect(redirectUrl); } - string redirectUrl = $"{Request.PathBase}/home"; - return Redirect(redirectUrl); + return RenderError(model); } [Authorize] diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 30738c2d..6130d1b6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -52,7 +52,7 @@ public async Task SignIn(string userNameOrEmail, string password, return SignInResult.Failed; } - return await signInManager.PasswordSignInAsync(member.UserName, password, staySignedIn, false); + return await signInManager.PasswordSignInAsync(member.UserName!, password, staySignedIn, false); } catch (Exception ex) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index 5d650be4..d92f8522 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -2,34 +2,42 @@ @model SignInWidgetViewModel - -
+
-
+
+ @* Include hidden inputs for widget display and links. + If server-side validation fails, these values will allow the form to be properly re-rendered. *@ + + + + + + + -
-
- -
-
- - -
+
+
+
+
+ + +
+
-
-
- -
-
- - -
+
+
+ +
+
+ +
+ - \ No newline at end of file +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 8668cd78..139271d9 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -2,12 +2,30 @@ @model SignInWidgetViewModel +@{ + // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. + var formDivId = $"signInForm{Guid.NewGuid()}"; + + bool isMisconfigured = Model == null + || string.IsNullOrWhiteSpace(Model.BaseUrl) + || string.IsNullOrWhiteSpace(Model.SubmitButtonText) + || string.IsNullOrWhiteSpace(Model.UserNameOrEmailLabel) + || string.IsNullOrWhiteSpace(Model.PasswordLabel) + || string.IsNullOrWhiteSpace(Model.StaySignedInLabel); +} +@if (isMisconfigured) +{ + + + + + return; +}

@Model.FormTitle

@if(Model.DisplayForm) { - var formDivId = $"signInForm{Guid.NewGuid()}"; @using (Html.AjaxBeginForm("Autheticate", "Authentication", new AjaxOptions { HttpMethod = "POST", @@ -15,10 +33,12 @@ UpdateTargetId = formDivId }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) { - +
+ +
} } else { -

already signed in

+

already signed in, the signout button will go here

} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index 618920d8..80b5909f 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -52,7 +52,7 @@ public class SignInWidgetViewModel //FORM PROPERTIES [DataType(DataType.Text)] - [Required()] + [Required(ErrorMessage = "Please enter your user name or email address.")] [MaxLength(100)] public string UserNameOrEmail { get; set; } = string.Empty; From cc962e48411ab821cd45cc3ae4eb193d95938d75 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 12 Nov 2024 22:13:37 -0500 Subject: [PATCH 20/60] GH-89 :: fix sign in button formatting in Sign in widget; Add LinkOrSignOut to Sign in page; render LinkOrSignOut widget in the header (TODO: retrieve the Sign in page. For now it only shows up if user is authenticated) --- ...4-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml | 6 +++--- .../ComponentIdentifiers.cs | 5 +++++ .../Features/Header/Header.cshtml | 19 +++++++++++++++++-- .../LinkOrSignOutWidgetProperties.cs | 2 +- .../Widgets/SignIn/SignInForm.cshtml | 4 ++-- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml index 14109f33..4f66ef4c 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml @@ -13,12 +13,12 @@ 2024-11-12 21:09:53Z 46487f03-5214-475f-8a76-57c4fa27c1f7 True - 2024-11-12 21:09:53Z + 2024-11-13 02:44:12Z - + - + 2 \ No newline at end of file diff --git a/src/TrainingGuides.Web/ComponentIdentifiers.cs b/src/TrainingGuides.Web/ComponentIdentifiers.cs index 01d68c25..0a84d039 100644 --- a/src/TrainingGuides.Web/ComponentIdentifiers.cs +++ b/src/TrainingGuides.Web/ComponentIdentifiers.cs @@ -5,6 +5,8 @@ using TrainingGuides.Web.Features.LandingPages.Widgets.CallToAction; using TrainingGuides.Web.Features.LandingPages.Widgets.HeroBanner; using TrainingGuides.Web.Features.LandingPages.Widgets.SimpleCallToAction; +using TrainingGuides.Web.Features.Membership.Widgets.Authentication; +using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; using TrainingGuides.Web.Features.Products.Widgets.Product; using TrainingGuides.Web.Features.Products.Widgets.ProductComparator; using TrainingGuides.Web.Features.Shared.Sections.FormColumn; @@ -36,5 +38,8 @@ public static class Widgets public const string SIMPLE_CALL_TO_ACTION = SimpleCallToActionWidgetViewComponent.IDENTIFIER; public const string PRODUCT = ProductWidgetViewComponent.IDENTIFIER; public const string VIDEO_EMBED = VideoEmbedWidgetViewComponent.IDENTIFIER; + public const string SING_IN = SignInWidgetViewComponent.IDENTIFIER; + public const string LINK_OR_SIGN_OUT = LinkOrSignOutWidgetViewComponent.IDENTIFIER; + } } diff --git a/src/TrainingGuides.Web/Features/Header/Header.cshtml b/src/TrainingGuides.Web/Features/Header/Header.cshtml index 462b6369..f89828c3 100644 --- a/src/TrainingGuides.Web/Features/Header/Header.cshtml +++ b/src/TrainingGuides.Web/Features/Header/Header.cshtml @@ -1,4 +1,6 @@ -@model TrainingGuides.Web.Features.Header.HeaderViewModel +@using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut + +@model TrainingGuides.Web.Features.Header.HeaderViewModel
+
+ @{ + // Prepares properties for redering the "Link or sign out" widget + var widgetProperties = new LinkOrSignOutWidgetProperties() + { + UnauthenticatedButtonText = "Sign in", + UnauthenticatedTargetContentPage = Enumerable.Empty(), //TODO: retrieve and add the sign in page (by path?) + AuthenticatedButtonText = "Sign out" + }; + } + @* Renders the Form widget *@ + @await Html.Kentico().RenderStandaloneWidgetAsync(ComponentIdentifiers.Widgets.LINK_OR_SIGN_OUT, widgetProperties) +
- \ No newline at end of file + diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs index f4151ddc..e31dca72 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs @@ -32,7 +32,7 @@ public class LinkOrSignOutWidgetProperties : IWidgetProperties public string AuthenticatedText { get; set; } = string.Empty; [TextInputComponent( - Label = "Authenticated text", + Label = "Authenticated button text", ExplanationText = "Text for the 'Sign out' link button when the visitor is authenticated.", Order = 40)] public string AuthenticatedButtonText { get; set; } = string.Empty; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index d92f8522..35817f3e 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -38,6 +38,6 @@
- - + +
\ No newline at end of file From cfd2bd6158ecf813d75e91b921d859b41299be21 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 12 Nov 2024 22:50:41 -0500 Subject: [PATCH 21/60] GH-89 :: UI improvements --- ...46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml | 6 +++--- .../Features/Membership/Widgets/SignIn/SignInForm.cshtml | 5 +++-- .../Membership/Widgets/SignIn/SignInWidget.cshtml | 8 +++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml index 4f66ef4c..19fecfe9 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml @@ -13,12 +13,12 @@ 2024-11-12 21:09:53Z 46487f03-5214-475f-8a76-57c4fa27c1f7 True - 2024-11-13 02:44:12Z + 2024-11-13 03:40:25Z - + - + 2 \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index 35817f3e..58cea2ea 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -38,6 +38,7 @@ - - +
+ +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 139271d9..21f59cfd 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -22,7 +22,9 @@ return; } -

@Model.FormTitle

+
+

@Model.FormTitle

+
@if(Model.DisplayForm) { @@ -38,7 +40,3 @@ } } -else -{ -

already signed in, the signout button will go here

-} From e439654a420dfd04042ae8243cb15f2c25f13200 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 13 Nov 2024 08:48:16 -0500 Subject: [PATCH 22/60] GH-86 :: adjust form target and controller action name for sign out, add signed-in status check before rendering registration form --- ...d-4fbb-84e2-b146431792ab_en@8cb2345696.xml | 4 +-- .../Controllers/AuthenticationController.cs | 4 +-- .../LinkOrSignOutWidgetProperties.cs | 2 +- .../LinkOrSignOutWidgetViewComponent.cs | 2 +- .../Widgets/LinkOrSignOut/SignOutForm.cshtml | 2 +- .../Registration/RegistrationWidget.cshtml | 27 +++++++++++-------- .../RegistrationWidgetViewComponent.cs | 2 +- src/TrainingGuides.Web/Program.cs | 4 ++- 8 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml index 154d7be2..9ebdd679 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml @@ -13,9 +13,9 @@ 2024-11-12 21:22:13Z 720f4866-de8d-4fbb-84e2-b146431792ab True - 2024-11-12 21:25:55Z + 2024-11-13 13:11:23Z -


"},"fieldIdentifiers":{"content":"b5c0822e-47b2-45ad-bb41-6c8aff165cd3"}}]},{"identifier":"1c125c5a-9016-4e68-bd9d-e09b2d001c3d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fabf2b85-2b37-4c1e-92b3-a718b57581c6","properties":{"unauthenticatedText":"Already have an account?","unauthenticatedButtonText":"Sign in here","unauthenticatedTargetContentPage":[{"webPageGuid":"377ca7c4-eea9-49a0-9d58-282b5127c7ff"}],"authenticatedText":"Sign out","authenticatedButtonText":"You are already registered."},"fieldIdentifiers":{"unauthenticatedText":"466b3cbc-8dee-4b03-ae78-4b11346248f0","unauthenticatedButtonText":"0b8b7c48-efb9-4288-a81e-13a805bb34d3","unauthenticatedTargetContentPage":"3ac28b30-e714-45ec-a8c7-e35778dd8469","authenticatedText":"cd9699ae-fd9f-471f-8520-9a00965002db","authenticatedButtonText":"82514014-d110-4c54-8523-9e0274984af0"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9521150d-c46a-4fa7-9313-1fdd4ed8c36c","colorScheme":"187c4225-712c-4f9f-88e0-f9986962bfea","cornerStyle":"6c91ad40-65be-4ece-89a8-b20898afd525","columnLayout":"b754983b-2cb9-4bad-a629-e768046b1114"}}]}]}]]> +


"},"fieldIdentifiers":{"content":"b5c0822e-47b2-45ad-bb41-6c8aff165cd3"}}]},{"identifier":"1c125c5a-9016-4e68-bd9d-e09b2d001c3d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fabf2b85-2b37-4c1e-92b3-a718b57581c6","properties":{"unauthenticatedText":"Already have an account?","unauthenticatedButtonText":"Sign in here","unauthenticatedTargetContentPage":[{"webPageGuid":"377ca7c4-eea9-49a0-9d58-282b5127c7ff"}],"authenticatedText":"You are already registered.","authenticatedButtonText":"Sign out"},"fieldIdentifiers":{"unauthenticatedText":"466b3cbc-8dee-4b03-ae78-4b11346248f0","unauthenticatedButtonText":"0b8b7c48-efb9-4288-a81e-13a805bb34d3","unauthenticatedTargetContentPage":"3ac28b30-e714-45ec-a8c7-e35778dd8469","authenticatedText":"cd9699ae-fd9f-471f-8520-9a00965002db","authenticatedButtonText":"82514014-d110-4c54-8523-9e0274984af0"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9521150d-c46a-4fa7-9313-1fdd4ed8c36c","colorScheme":"187c4225-712c-4f9f-88e0-f9986962bfea","cornerStyle":"6c91ad40-65be-4ece-89a8-b20898afd525","columnLayout":"b754983b-2cb9-4bad-a629-e768046b1114"}}]}]}]]>
diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 8c0a0913..2b8e806b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -45,9 +45,9 @@ public async Task Authenticate(SignInWidgetViewModel model) } [Authorize] - [HttpPost("/Authentication/Logout")] + [HttpPost("/Authentication/SignOut")] [ValidateAntiForgeryToken] - public async Task Logout(SignOutFormModel model) + public async Task SignOut(SignOutFormModel model) { await membershipService.SignOut(); return Redirect(model.RedirectUrl); diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs index e31dca72..b74c198b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetProperties.cs @@ -34,6 +34,6 @@ public class LinkOrSignOutWidgetProperties : IWidgetProperties [TextInputComponent( Label = "Authenticated button text", ExplanationText = "Text for the 'Sign out' link button when the visitor is authenticated.", - Order = 40)] + Order = 50)] public string AuthenticatedButtonText { get; set; } = string.Empty; } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs index ae74842a..55b652fe 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs @@ -13,7 +13,7 @@ name: "Link or Sign Out", propertiesType: typeof(LinkOrSignOutWidgetProperties), Description = $"Displays a line of text and a link button that will log out a member if they are authenticated and link to a specified page (such as Sign-in or Registration) if not.", - IconClass = "icon-bubble")] + IconClass = "icon-arrow-leave-square")] namespace TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml index d4a20756..e0e6f90b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/SignOutForm.cshtml @@ -1,7 +1,7 @@ @using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut @model SignOutFormModel -
diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index 0bf4604d..71e389eb 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -28,14 +28,19 @@

@Model.FormTitle

-@using (Html.AjaxBeginForm("Register", "Registration", new AjaxOptions - { - HttpMethod = "POST", - InsertionMode = InsertionMode.Replace, - UpdateTargetId = formDivId - }, new { action = $"{Model.BaseUrl}/Registration/Register" })) - { -
- -
- } +@if (Model.DisplayForm) +{ + @using (Html.AjaxBeginForm("Register", "Registration", new AjaxOptions + { + HttpMethod = "POST", + InsertionMode = InsertionMode.Replace, + UpdateTargetId = formDivId + }, new { action = $"{Model.BaseUrl}/Registration/Register" })) + { +
+ +
+ } +} + + diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs index e29e047a..7d4904ea 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -34,7 +34,7 @@ public async Task InvokeAsync(RegistrationWidgetProperties var registerModel = new RegistrationWidgetViewModel { BaseUrl = httpRequestService.GetBaseUrl(), - DisplayForm = await membershipService.IsMemberAuthenticated(), + DisplayForm = !await membershipService.IsMemberAuthenticated(), ShowName = properties.ShowName, ShowExtraFields = properties.ShowExtraFields, FormTitle = properties.FormTitle, diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 32cfc813..dbc3ca00 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -98,7 +98,7 @@ builder.Services.AddTrainingGuidesServices(); builder.Services.AddTrainingGuidesOptions(); -builder.Services.AddControllersWithViews( options => options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true); +builder.Services.AddControllersWithViews(options => options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true); builder.Services.AddMvc().AddMvcLocalization(); builder.Services.AddDistributedMemoryCache(); @@ -113,6 +113,8 @@ app.UseAuthentication(); +app.UseAuthorization(); + app.Kentico().MapRoutes(); // Functionality related to cross-site tracking is currently disabled while we investigate an issue (#85 on GitHub) From 8709d6165754e6016bc99beb7719a5dccca3771d Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 13 Nov 2024 15:58:44 -0500 Subject: [PATCH 23/60] GH-89 :: add contact mapping for membership, update custom field names on member class --- .../cms.systemtable_cms.member/edit.xml | 8 ++-- .../@global/cms.systemtable/cms.member.xml | 8 ++-- .../Controllers/RegistrationController.cs | 3 +- .../Features/Membership/GuidesMember.cs | 20 ++++---- .../TrainingGuidesMemberToContactMapper.cs | 48 +++++++++++++++++++ 5 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml index 794fed23..124ec3fe 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.alternativeform/cms.systemtable_cms.member/edit.xml @@ -58,7 +58,7 @@ - + Kentico.Administration.TextInput @@ -68,7 +68,7 @@ False - + Kentico.Administration.TextInput @@ -78,7 +78,7 @@ False - + Kentico.Administration.Checkbox @@ -88,7 +88,7 @@ False - + Kentico.Administration.TextInput diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml index bb8b05e4..2c73c169 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.systemtable/cms.member.xml @@ -16,10 +16,10 @@ - - - - + + + + 07c5d145-7cbc-4c75-9a96-6d4948bf6c73 diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 61a501bb..1e177994 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -24,7 +24,8 @@ public async Task Register(RegistrationWidgetViewModel model) GivenName = model.GivenName, FamilyName = model.FamilyName, FamilyNameFirst = model.FamilyNameFirst, - FavoriteCoffee = model.FavoriteCoffee + FavoriteCoffee = model.FavoriteCoffee, + Enabled = true // TODO: remove the Enabled property when email confirmation is implemented }; try diff --git a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs index ea4c784f..c7c90c84 100644 --- a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs +++ b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs @@ -32,7 +32,7 @@ public override void MapToMemberInfo(MemberInfo target) } /* - * base.MapToMemberInfo will set target.MemberPassword everytime + * base.MapToMemberInfo will set target.MemberPassword every time * however we do not want to set it if PasswordHash is null, * and this stores the original so we can revert it */ @@ -45,20 +45,20 @@ public override void MapToMemberInfo(MemberInfo target) target.MemberPassword = originalPasswordHash; } - _ = target.SetValue("MemberGivenName", GivenName); - _ = target.SetValue("MemberFamilyName", FamilyName); - _ = target.SetValue("MemberFamilyNameFirst", FamilyNameFirst); - _ = target.SetValue("MemberFavoriteCoffee", FavoriteCoffee); + _ = target.SetValue("GuidesMemberGivenName", GivenName); + _ = target.SetValue("GuidesMemberFamilyName", FamilyName); + _ = target.SetValue("GuidesMemberFamilyNameFirst", FamilyNameFirst); + _ = target.SetValue("GuidesMemberFavoriteCoffee", FavoriteCoffee); } public override void MapFromMemberInfo(MemberInfo source) { base.MapFromMemberInfo(source); - GivenName = source.GetValue("MemberGivenName", ""); - FamilyName = source.GetValue("MemberFamilyName", ""); - FamilyNameFirst = source.GetValue("MemberFamilyNameFirst", false); - FavoriteCoffee = source.GetValue("MemberFavoriteCoffee", ""); + GivenName = source.GetValue("GuidesMemberGivenName", string.Empty); + FamilyName = source.GetValue("GuidesMemberFamilyName", string.Empty); + FamilyNameFirst = source.GetValue("GuidesMemberFamilyNameFirst", false); + FavoriteCoffee = source.GetValue("GuidesMemberFavoriteCoffee", string.Empty); Created = source.MemberCreated; } @@ -73,6 +73,6 @@ public static GuidesMember FromMemberInfo(MemberInfo memberInfo) public static class MemberInfoExtensions { - public static GuidesMember AsMember(this MemberInfo member) => + public static GuidesMember AsGuidesMember(this MemberInfo member) => GuidesMember.FromMemberInfo(member); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs b/src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs new file mode 100644 index 00000000..80d90713 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs @@ -0,0 +1,48 @@ +using CMS; +using CMS.ContactManagement; +using CMS.Membership; + +using Kentico.OnlineMarketing.Web.Mvc; + +using TrainingGuides.Web.Features.Membership.Mappers; + +[assembly: RegisterImplementation(typeof(IMemberToContactMapper), typeof(TrainingGuidesMemberToContactMapper))] + +namespace TrainingGuides.Web.Features.Membership.Mappers; +public class TrainingGuidesMemberToContactMapper : IMemberToContactMapper +{ + // Stores the default implementation of the IMemberToContactMapper service + private readonly IMemberToContactMapper memberToContactMapper; + + public TrainingGuidesMemberToContactMapper(IMemberToContactMapper memberToContactMapper) + { + this.memberToContactMapper = memberToContactMapper; + } + + public void Map(MemberInfo member, ContactInfo contact) + { + if (member is null || contact is null) + { + return; + } + var guidesMember = member.AsGuidesMember(); + + if (!string.IsNullOrWhiteSpace(guidesMember.GivenName)) + { + contact.ContactFirstName = guidesMember.GivenName; + } + if (!string.IsNullOrWhiteSpace(guidesMember.FamilyName)) + { + _ = contact.ContactLastName = guidesMember.FamilyName; + } + if (!string.IsNullOrWhiteSpace(guidesMember.FavoriteCoffee)) + { + _ = contact.SetValue("TrainingGuidesContactFavoriteCoffee", guidesMember.FavoriteCoffee); + } + + //Sets the Member ID of the current contact + contact.SetValue("TrainingGuidesContactMemberId", guidesMember.Id); + + memberToContactMapper.Map(member, contact); + } +} \ No newline at end of file From b173135a8b055ad51d0718cd4ae0bfffb984d8a2 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Wed, 13 Nov 2024 17:43:49 -0500 Subject: [PATCH 24/60] GH-89 :: redirecting after successful sign in. --- .../Authentication/SignInWidgetViewModelTests.cs | 3 +++ .../Controllers/AuthenticationController.cs | 12 ++++-------- .../Membership/Widgets/SignIn/SignInForm.cshtml | 1 + .../Membership/Widgets/SignIn/SignInWidget.cshtml | 3 ++- .../Widgets/SignIn/SignInWidgetProperties.cs | 8 ++++++++ .../Widgets/SignIn/SignInWidgetViewComponent.cs | 9 ++++++++- .../Widgets/SignIn/SignInWidgetViewModel.cs | 6 ++++++ .../Features/Shared/Services/HttpRequestService.cs | 12 ++++++++++++ .../Features/Shared/Services/IHttpRequestService.cs | 3 +++ 9 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs index 5ae9bde7..c46a5907 100644 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs @@ -15,6 +15,9 @@ public SignInWidgetViewModelTests() [Fact] public void WhenInitialized_BaseUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.BaseUrl); + [Fact] + public void WhenInitialized_RedirectUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.RedirectUrl); + [Fact] public void WhenInitialized_DisplayForm_IsTrue() => Assert.True(viewModel.DisplayForm); diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 2b8e806b..f324dadf 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -35,13 +35,9 @@ public async Task Authenticate(SignInWidgetViewModel model) var signInResult = await membershipService.SignIn(model.UserNameOrEmail, model.Password, model.StaySignedIn); - if (signInResult.Succeeded) - { - string redirectUrl = $"{model.BaseUrl}/home"; - return Redirect(redirectUrl); - } - - return RenderError(model); + return signInResult.Succeeded + ? Content("Success!") + : RenderError(model); } [Authorize] @@ -52,4 +48,4 @@ public async Task SignOut(SignOutFormModel model) await membershipService.SignOut(); return Redirect(model.RedirectUrl); } -} \ No newline at end of file +} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index 58cea2ea..cf536a98 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -8,6 +8,7 @@ @* Include hidden inputs for widget display and links. If server-side validation fails, these values will allow the form to be properly re-rendered. *@ + diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 21f59cfd..0d4dc318 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -32,7 +32,8 @@ { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, - UpdateTargetId = formDivId + UpdateTargetId = formDivId, + OnSuccess = $"window.location.href = '{Model.RedirectUrl}'" }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) {
diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs index 6b04118f..052aef6e 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs @@ -1,5 +1,6 @@ using Kentico.PageBuilder.Web.Mvc; using Kentico.Xperience.Admin.Base.FormAnnotations; +using Kentico.Xperience.Admin.Websites.FormAnnotations; namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; @@ -44,4 +45,11 @@ public class SignInWidgetProperties : IWidgetProperties Label = "Stay signed in label", Order = 50)] public string StaySignedInLabel { get; set; } = "Stay signed in"; + + [WebPageSelectorComponent( + Label = "Redirect page", + ExplanationText = "Page to redirect to after successful sign in. If empty, the the site visitor will be navigated to home page.", + MaximumPages = 1, + Order = 60)] + public IEnumerable RedirectPage { get; set; } = Enumerable.Empty(); } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs index 3c4b5f52..c9e26960 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs @@ -1,3 +1,4 @@ +using Kentico.Content.Web.Mvc.Routing; using Kentico.PageBuilder.Web.Mvc; using Microsoft.AspNetCore.Mvc; using TrainingGuides.Web.Features.Membership.Services; @@ -17,21 +18,27 @@ public class SignInWidgetViewComponent : ViewComponent { private readonly IHttpRequestService httpRequestService; private readonly IMembershipService membershipService; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; + public const string IDENTIFIER = "TrainingGuides.SignInWidget"; public SignInWidgetViewComponent( IHttpRequestService httpRequestService, - IMembershipService membershipService) + IMembershipService membershipService, + IPreferredLanguageRetriever preferredLanguageRetriever) { this.httpRequestService = httpRequestService; this.membershipService = membershipService; + this.preferredLanguageRetriever = preferredLanguageRetriever; } public async Task InvokeAsync(SignInWidgetProperties properties) { + // var redirectUrl = httpRequestService.GetPageUrlForLanguage(properties.RedirectPage.FirstOrDefault()., preferredLanguageRetriever.Get()); var widgetViewModel = new SignInWidgetViewModel { BaseUrl = httpRequestService.GetBaseUrl(), + RedirectUrl = "/", //TODO retrieve URL of set properties.RedirectPage DisplayForm = !await membershipService.IsMemberAuthenticated(), FormTitle = properties.FormTitle, SubmitButtonText = properties.SubmitButtonText, diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index 80b5909f..72fe2980 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -13,6 +13,12 @@ public class SignInWidgetViewModel [HiddenInput] public string BaseUrl { get; set; } = string.Empty; + /// + /// URL of the site to redirect to after successful sing in + /// + [HiddenInput] + public string RedirectUrl { get; set; } = string.Empty; + /// /// Determines whether the widget should display the form. E.g., if the user is already authenticated, the form should not be displayed. Instead they should see a sign out button /// diff --git a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs index 36df50ae..4a891037 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs @@ -70,4 +70,16 @@ public async Task GetCurrentPageUrlForLanguage(string language) var url = await webPageUrlRetriever.Retrieve(currentPage.WebPageItemID, language); return url.RelativePath; } + + /// + /// Retrieves URL of the specified page for a specific language + /// + /// Webpage to retrieve a URL of. + /// Two-letter language code (e.g., "es" for Spanish, "en" for English) + /// Language specific URL of the current page (e.g. website.com/es/page) + public async Task GetPageUrlForLanguage(RoutedWebPage webpage, string language) + { + var url = await webPageUrlRetriever.Retrieve(webpage.WebPageItemID, language); + return url.RelativePath; + } } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs index d8001615..fcd7eb25 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs @@ -1,3 +1,5 @@ +using Kentico.Content.Web.Mvc; + namespace TrainingGuides.Web.Features.Shared.Services; public interface IHttpRequestService @@ -5,4 +7,5 @@ public interface IHttpRequestService public string GetBaseUrl(); public string GetBaseUrlWithLanguage(); public Task GetCurrentPageUrlForLanguage(string language); + public Task GetPageUrlForLanguage(RoutedWebPage webpage, string language); } From 72bd1b2cc09d8dcce8cdf3304467e9f7943c1051 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Thu, 14 Nov 2024 10:55:08 -0500 Subject: [PATCH 25/60] GH-89 :: redirect page after sign in - let user pick is in the widget, add tests --- .../SignInWidgetViewModelTests.cs | 47 -------- .../SignIn/SignInWidgetViewComponentTests.cs | 104 ++++++++++++++++++ .../SignIn/SignInWidgetViewModelTests.cs | 47 ++++++++ ...4-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml | 4 +- .../ComponentIdentifiers.cs | 2 +- .../Controllers/AuthenticationController.cs | 2 +- .../Widgets/SignIn/SignInForm.cshtml | 2 +- .../Widgets/SignIn/SignInWidget.cshtml | 2 +- .../Widgets/SignIn/SignInWidgetProperties.cs | 2 +- .../SignIn/SignInWidgetViewComponent.cs | 21 ++-- .../Widgets/SignIn/SignInWidgetViewModel.cs | 2 +- .../Shared/Services/HttpRequestService.cs | 11 +- .../Shared/Services/IHttpRequestService.cs | 4 +- src/TrainingGuides.Web/Program.cs | 11 +- 14 files changed, 185 insertions(+), 76 deletions(-) delete mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs deleted file mode 100644 index c46a5907..00000000 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Authentication/SignInWidgetViewModelTests.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Xunit; -using TrainingGuides.Web.Features.Membership.Widgets.Authentication; - -namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.Authentication; - -public class SignInWidgetViewModelTests -{ - private readonly SignInWidgetViewModel viewModel; - - public SignInWidgetViewModelTests() - { - viewModel = new(); - } - - [Fact] - public void WhenInitialized_BaseUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.BaseUrl); - - [Fact] - public void WhenInitialized_RedirectUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.RedirectUrl); - - [Fact] - public void WhenInitialized_DisplayForm_IsTrue() => Assert.True(viewModel.DisplayForm); - - [Fact] - public void WhenInitialized_FormTitle_IsEmpty() => Assert.Equal(string.Empty, viewModel.FormTitle); - - [Fact] - public void WhenInitialized_SubmitButtonText_IsEmpty() => Assert.Equal(string.Empty, viewModel.SubmitButtonText); - - [Fact] - public void WhenInitialized_UserNameOrEmailLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.UserNameOrEmailLabel); - - [Fact] - public void WhenInitialized_PasswordLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.PasswordLabel); - - [Fact] - public void WhenInitialized_StaySignedInLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.StaySignedInLabel); - - [Fact] - public void WhenInitialized_UserNameOrEmail_IsEmpty() => Assert.Equal(string.Empty, viewModel.UserNameOrEmail); - - [Fact] - public void WhenInitialized_Password_IsEmpty() => Assert.Equal(string.Empty, viewModel.Password); - - [Fact] - public void WhenInitialized_StaySignedIn_IsFalse() => Assert.False(viewModel.StaySignedIn); -} \ No newline at end of file diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs new file mode 100644 index 00000000..2f967dc7 --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs @@ -0,0 +1,104 @@ +using Kentico.Content.Web.Mvc.Routing; +using Moq; +using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Widgets.SignIn; +using TrainingGuides.Web.Features.Shared.Services; +using Xunit; + +namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.SignIn; + +public class SignInWidgetViewComponentTests +{ + private readonly SignInWidgetViewComponent viewComponent; + private readonly Mock httpRequestServiceMock; + private readonly Mock membershipServiceMock; + private readonly Mock preferredLanguageRetrieverMock; + + private const string BASE_URL = "http://localhost:5000"; + private const string PAGE_URL = "/page"; + private const string ROOT_URL = "/"; + private const string SIGN_IN = "Sign In"; + private const string SUBMIT = "Submit"; + private const string USERNAME = "Username"; + private const string PASSWORD = "Password"; + private const string STAY_SIGNED_IN = "Stay Signed In"; + + private readonly SignInWidgetProperties referenceProperties; + + public SignInWidgetViewComponentTests() + { + httpRequestServiceMock = new Mock(); + httpRequestServiceMock.Setup(x => x.GetBaseUrl()).Returns(BASE_URL); + + membershipServiceMock = new Mock(); + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); + + preferredLanguageRetrieverMock = new Mock(); + preferredLanguageRetrieverMock.Setup(x => x.Get()).Returns("en"); + + viewComponent = new SignInWidgetViewComponent(httpRequestServiceMock.Object, membershipServiceMock.Object, preferredLanguageRetrieverMock.Object); + + referenceProperties = new SignInWidgetProperties() + { + FormTitle = SIGN_IN, + SubmitButtonText = SUBMIT, + UserNameLabel = USERNAME, + PasswordLabel = PASSWORD, + StaySignedInLabel = STAY_SIGNED_IN + }; + } + + [Fact] + public async Task BuildWidgetViewModel_ReturnsWidgetViewModel_WithBaseUrlSet() + { + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.NotEmpty(viewModel.BaseUrl); + } + + [Fact] + public async Task BuildWidgetViewModel_WhenUserSetsRedirectPage_SetsRedirectUrl_ToPageUrl() + { + httpRequestServiceMock.Setup(x => x.GetPageRelativeUrl(It.IsAny(), It.IsAny())).ReturnsAsync($"~{PAGE_URL}"); + referenceProperties.RedirectPage = [new() { WebPageGuid = Guid.NewGuid() }]; + + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.Equal(PAGE_URL, viewModel.RedirectUrl); + } + + [Fact] + public async Task BuildWidgetViewModel_WhenUserDoesNOTSetRedirectPage_SetsRedirectUrl_ToRoot() + { + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.Equal(ROOT_URL, viewModel.RedirectUrl); + } + + [Fact] + public async Task BuildWidgetViewModel_WhenUserIsAuthenticated_SetsDisplayForm_ToFalse() + { + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); + + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.False(viewModel.DisplayForm); + } + + [Fact] + public async Task BuildWidgetViewModel_WhenUserIsNOTAuthenticated_SetsDisplayForm_ToTrue() + { + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(false); + + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.True(viewModel.DisplayForm); + } + + [Fact] + public async Task BuildWidgetViewModel_SetsFormLabels_BasedOnWidgetProperties() + { + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.Equal(referenceProperties.FormTitle, viewModel.FormTitle); + Assert.Equal(referenceProperties.SubmitButtonText, viewModel.SubmitButtonText); + Assert.Equal(referenceProperties.UserNameLabel, viewModel.UserNameOrEmailLabel); + Assert.Equal(referenceProperties.PasswordLabel, viewModel.PasswordLabel); + Assert.Equal(referenceProperties.StaySignedInLabel, viewModel.StaySignedInLabel); + } + +} \ No newline at end of file diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs new file mode 100644 index 00000000..fb91ef9f --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs @@ -0,0 +1,47 @@ +using Xunit; +using TrainingGuides.Web.Features.Membership.Widgets.SignIn; + +namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.SignIn; + +public class SignInWidgetViewModelTests +{ + private readonly SignInWidgetViewModel viewModel; + + public SignInWidgetViewModelTests() + { + viewModel = new(); + } + + [Fact] + public void WhenModelInitialized_BaseUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.BaseUrl); + + [Fact] + public void WhenModelInitialized_RedirectUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.RedirectUrl); + + [Fact] + public void WhenModelInitialized_DisplayForm_IsTrue() => Assert.True(viewModel.DisplayForm); + + [Fact] + public void WhenModelInitialized_FormTitle_IsEmpty() => Assert.Equal(string.Empty, viewModel.FormTitle); + + [Fact] + public void WhenModelInitialized_SubmitButtonText_IsEmpty() => Assert.Equal(string.Empty, viewModel.SubmitButtonText); + + [Fact] + public void WhenModelInitialized_UserNameOrEmailLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.UserNameOrEmailLabel); + + [Fact] + public void WhenModelInitialized_PasswordLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.PasswordLabel); + + [Fact] + public void WhenModelInitialized_StaySignedInLabel_IsEmpty() => Assert.Equal(string.Empty, viewModel.StaySignedInLabel); + + [Fact] + public void WhenModelInitialized_UserNameOrEmail_IsEmpty() => Assert.Equal(string.Empty, viewModel.UserNameOrEmail); + + [Fact] + public void WhenModelInitialized_Password_IsEmpty() => Assert.Equal(string.Empty, viewModel.Password); + + [Fact] + public void WhenModelInitialized_StaySignedIn_IsFalse() => Assert.False(viewModel.StaySignedIn); +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml index 19fecfe9..8e2ac8f5 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml @@ -13,9 +13,9 @@ 2024-11-12 21:09:53Z 46487f03-5214-475f-8a76-57c4fa27c1f7 True - 2024-11-13 03:40:25Z + 2024-11-14 15:53:19Z - + diff --git a/src/TrainingGuides.Web/ComponentIdentifiers.cs b/src/TrainingGuides.Web/ComponentIdentifiers.cs index 0a84d039..15eb448e 100644 --- a/src/TrainingGuides.Web/ComponentIdentifiers.cs +++ b/src/TrainingGuides.Web/ComponentIdentifiers.cs @@ -5,7 +5,7 @@ using TrainingGuides.Web.Features.LandingPages.Widgets.CallToAction; using TrainingGuides.Web.Features.LandingPages.Widgets.HeroBanner; using TrainingGuides.Web.Features.LandingPages.Widgets.SimpleCallToAction; -using TrainingGuides.Web.Features.Membership.Widgets.Authentication; +using TrainingGuides.Web.Features.Membership.Widgets.SignIn; using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; using TrainingGuides.Web.Features.Products.Widgets.Product; using TrainingGuides.Web.Features.Products.Widgets.ProductComparator; diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index f324dadf..d1101e4c 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using TrainingGuides.Web.Features.Membership.Services; -using TrainingGuides.Web.Features.Membership.Widgets.Authentication; +using TrainingGuides.Web.Features.Membership.Widgets.SignIn; using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; namespace TrainingGuides.Web.Features.Membership.Controllers; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index cf536a98..5d7d5a16 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -1,4 +1,4 @@ -@using TrainingGuides.Web.Features.Membership.Widgets.Authentication +@using TrainingGuides.Web.Features.Membership.Widgets.SignIn @model SignInWidgetViewModel diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 0d4dc318..8157dd85 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -1,4 +1,4 @@ -@using TrainingGuides.Web.Features.Membership.Widgets.Authentication +@using TrainingGuides.Web.Features.Membership.Widgets.SignIn @model SignInWidgetViewModel diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs index 052aef6e..e2b11681 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetProperties.cs @@ -2,7 +2,7 @@ using Kentico.Xperience.Admin.Base.FormAnnotations; using Kentico.Xperience.Admin.Websites.FormAnnotations; -namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; +namespace TrainingGuides.Web.Features.Membership.Widgets.SignIn; public class SignInWidgetProperties : IWidgetProperties { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs index c9e26960..00d92600 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs @@ -2,7 +2,7 @@ using Kentico.PageBuilder.Web.Mvc; using Microsoft.AspNetCore.Mvc; using TrainingGuides.Web.Features.Membership.Services; -using TrainingGuides.Web.Features.Membership.Widgets.Authentication; +using TrainingGuides.Web.Features.Membership.Widgets.SignIn; using TrainingGuides.Web.Features.Shared.Services; [assembly: RegisterWidget( @@ -13,7 +13,7 @@ Description = "Displays a sign in form for members.", IconClass = "icon-user")] -namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; +namespace TrainingGuides.Web.Features.Membership.Widgets.SignIn; public class SignInWidgetViewComponent : ViewComponent { private readonly IHttpRequestService httpRequestService; @@ -32,13 +32,20 @@ public SignInWidgetViewComponent( this.preferredLanguageRetriever = preferredLanguageRetriever; } - public async Task InvokeAsync(SignInWidgetProperties properties) + public async Task InvokeAsync(SignInWidgetProperties properties) => + View("~/Features/Membership/Widgets/SignIn/SignInWidget.cshtml", await BuildWidgetViewModel(properties)); + + public async Task BuildWidgetViewModel(SignInWidgetProperties properties) { - // var redirectUrl = httpRequestService.GetPageUrlForLanguage(properties.RedirectPage.FirstOrDefault()., preferredLanguageRetriever.Get()); - var widgetViewModel = new SignInWidgetViewModel + var redirectPage = properties.RedirectPage.FirstOrDefault(); + string redirectUrl = redirectPage == null + ? "/" + : (await httpRequestService.GetPageRelativeUrl(redirectPage.WebPageGuid, preferredLanguageRetriever.Get())).Replace("~", ""); + + return new SignInWidgetViewModel { BaseUrl = httpRequestService.GetBaseUrl(), - RedirectUrl = "/", //TODO retrieve URL of set properties.RedirectPage + RedirectUrl = redirectUrl, DisplayForm = !await membershipService.IsMemberAuthenticated(), FormTitle = properties.FormTitle, SubmitButtonText = properties.SubmitButtonText, @@ -46,7 +53,5 @@ public async Task InvokeAsync(SignInWidgetProperties prope PasswordLabel = properties.PasswordLabel, StaySignedInLabel = properties.StaySignedInLabel }; - - return View("~/Features/Membership/Widgets/SignIn/SignInWidget.cshtml", widgetViewModel); } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index 72fe2980..23afd590 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc; -namespace TrainingGuides.Web.Features.Membership.Widgets.Authentication; +namespace TrainingGuides.Web.Features.Membership.Widgets.SignIn; public class SignInWidgetViewModel { diff --git a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs index 4a891037..e1d5daf5 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs @@ -11,9 +11,10 @@ public class HttpRequestService : IHttpRequestService private readonly IWebPageUrlRetriever webPageUrlRetriever; private const string WEB_PAGE_URL_PATHS = "Kentico.WebPageUrlPaths"; - public HttpRequestService(IHttpContextAccessor httpContextAccessor, - IWebPageDataContextRetriever webPageDataContextRetriever, - IWebPageUrlRetriever webPageUrlRetriever) + public HttpRequestService( + IHttpContextAccessor httpContextAccessor, + IWebPageDataContextRetriever webPageDataContextRetriever, + IWebPageUrlRetriever webPageUrlRetriever) { this.httpContextAccessor = httpContextAccessor; this.webPageDataContextRetriever = webPageDataContextRetriever; @@ -77,9 +78,9 @@ public async Task GetCurrentPageUrlForLanguage(string language) /// Webpage to retrieve a URL of. /// Two-letter language code (e.g., "es" for Spanish, "en" for English) /// Language specific URL of the current page (e.g. website.com/es/page) - public async Task GetPageUrlForLanguage(RoutedWebPage webpage, string language) + public async Task GetPageRelativeUrl(Guid webpageGuid, string language) { - var url = await webPageUrlRetriever.Retrieve(webpage.WebPageItemID, language); + var url = await webPageUrlRetriever.Retrieve(webpageGuid, language); return url.RelativePath; } } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs index fcd7eb25..9b2d7b99 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs @@ -1,5 +1,3 @@ -using Kentico.Content.Web.Mvc; - namespace TrainingGuides.Web.Features.Shared.Services; public interface IHttpRequestService @@ -7,5 +5,5 @@ public interface IHttpRequestService public string GetBaseUrl(); public string GetBaseUrlWithLanguage(); public Task GetCurrentPageUrlForLanguage(string language); - public Task GetPageUrlForLanguage(RoutedWebPage webpage, string language); + public Task GetPageRelativeUrl(Guid webpageGuid, string language); } diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index dbc3ca00..f4476919 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -79,11 +79,12 @@ }); -builder.Services.AddIdentity(options => -{ - options.SignIn.RequireConfirmedAccount = false; - options.User.RequireUniqueEmail = false;//change this once we add email functionality -}) +builder.Services + .AddIdentity(options => + { + options.SignIn.RequireConfirmedAccount = false; + options.User.RequireUniqueEmail = false;//change this once we add email functionality + }) .AddUserStore>() .AddRoleStore() .AddUserManager>() From f05d5a350ee601b059d5edfc81e1806b2d779436 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 14 Nov 2024 11:37:58 -0500 Subject: [PATCH 26/60] GH-89 :: set code to remove cookies when the member signs out, so the same contact does not get associated with a different member if someone else logs in in the same browser session --- .../DataProtection/Shared/CookieNames.cs | 2 + .../TrainingGuidesMemberToContactMapper.cs | 79 +++++++++++++++++++ .../TrainingGuidesMemberToContactMapper.cs | 48 ----------- .../Membership/Services/MembershipService.cs | 21 ++++- 4 files changed, 100 insertions(+), 50 deletions(-) create mode 100644 src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs delete mode 100644 src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs diff --git a/src/TrainingGuides.Web/Features/DataProtection/Shared/CookieNames.cs b/src/TrainingGuides.Web/Features/DataProtection/Shared/CookieNames.cs index 8677009c..fdcd90f5 100644 --- a/src/TrainingGuides.Web/Features/DataProtection/Shared/CookieNames.cs +++ b/src/TrainingGuides.Web/Features/DataProtection/Shared/CookieNames.cs @@ -8,4 +8,6 @@ public static class CookieNames // System cookies public const string COOKIE_CONSENT_LEVEL = "trainingguides.cookieconsentlevel"; public const string COOKIE_ACCEPTANCE = "trainingguides.cookielevelselection"; + public const string CMS_COOKIE_LEVEL = "CMSCookieLevel"; + public const string CURRENT_CONTACT = "CurrentContact"; } diff --git a/src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs b/src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs new file mode 100644 index 00000000..dc99eb09 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs @@ -0,0 +1,79 @@ +using CMS; +using CMS.ContactManagement; +using CMS.DataEngine; +using CMS.Membership; + +using Kentico.OnlineMarketing.Web.Mvc; + +using TrainingGuides.Web.Features.Membership.ContactMapping; + +[assembly: RegisterImplementation(typeof(IMemberToContactMapper), typeof(TrainingGuidesMemberToContactMapper))] + +namespace TrainingGuides.Web.Features.Membership.ContactMapping; +public class TrainingGuidesMemberToContactMapper : IMemberToContactMapper +{ + private readonly IInfoProvider contactInfoProvider; + + public TrainingGuidesMemberToContactMapper(IInfoProvider contactInfoProvider) + { + this.contactInfoProvider = contactInfoProvider; + } + + /// + /// Maps a member to a contact and updates the contact if it has changed + /// + /// The member whose data should be transferred + /// The contact to transfer the data to + public void Map(MemberInfo member, ContactInfo contact) + { + if (member is null || contact is null) + return; + + contact = TransferMemberFieldsToContact(member, contact); + + UpdateContactIfChanged(contact); + } + + /// + /// Transfers values from member to contact + /// + /// The member whose data should be transferred + /// The contact to transfer the data to + /// The updated ContactInfo object, but DOES NOT save the contact data + public ContactInfo TransferMemberFieldsToContact(MemberInfo member, ContactInfo contact) + { + var guidesMember = member.AsGuidesMember(); + + if (!string.IsNullOrWhiteSpace(guidesMember.GivenName)) + { + contact.ContactFirstName = guidesMember.GivenName; + } + if (!string.IsNullOrWhiteSpace(guidesMember.FamilyName)) + { + _ = contact.ContactLastName = guidesMember.FamilyName; + } + if (!string.IsNullOrWhiteSpace(guidesMember.FavoriteCoffee)) + { + _ = contact.SetValue("TrainingGuidesContactFavoriteCoffee", guidesMember.FavoriteCoffee); + } + + // Sets the Member ID of the current contact + contact.SetValue("TrainingGuidesContactMemberId", guidesMember.Id); + + // For data security, do not overwrite contact email address if it is already set + if (string.IsNullOrWhiteSpace(contact.ContactEmail) && !string.IsNullOrWhiteSpace(guidesMember.Email)) + { + contact.ContactEmail = guidesMember.Email; + } + + return contact; + } + + private void UpdateContactIfChanged(ContactInfo contact) + { + if (contact.HasChanged) + { + contactInfoProvider.Set(contact); + } + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs b/src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs deleted file mode 100644 index 80d90713..00000000 --- a/src/TrainingGuides.Web/Features/Membership/Mappers/TrainingGuidesMemberToContactMapper.cs +++ /dev/null @@ -1,48 +0,0 @@ -using CMS; -using CMS.ContactManagement; -using CMS.Membership; - -using Kentico.OnlineMarketing.Web.Mvc; - -using TrainingGuides.Web.Features.Membership.Mappers; - -[assembly: RegisterImplementation(typeof(IMemberToContactMapper), typeof(TrainingGuidesMemberToContactMapper))] - -namespace TrainingGuides.Web.Features.Membership.Mappers; -public class TrainingGuidesMemberToContactMapper : IMemberToContactMapper -{ - // Stores the default implementation of the IMemberToContactMapper service - private readonly IMemberToContactMapper memberToContactMapper; - - public TrainingGuidesMemberToContactMapper(IMemberToContactMapper memberToContactMapper) - { - this.memberToContactMapper = memberToContactMapper; - } - - public void Map(MemberInfo member, ContactInfo contact) - { - if (member is null || contact is null) - { - return; - } - var guidesMember = member.AsGuidesMember(); - - if (!string.IsNullOrWhiteSpace(guidesMember.GivenName)) - { - contact.ContactFirstName = guidesMember.GivenName; - } - if (!string.IsNullOrWhiteSpace(guidesMember.FamilyName)) - { - _ = contact.ContactLastName = guidesMember.FamilyName; - } - if (!string.IsNullOrWhiteSpace(guidesMember.FavoriteCoffee)) - { - _ = contact.SetValue("TrainingGuidesContactFavoriteCoffee", guidesMember.FavoriteCoffee); - } - - //Sets the Member ID of the current contact - contact.SetValue("TrainingGuidesContactMemberId", guidesMember.Id); - - memberToContactMapper.Map(member, contact); - } -} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 6130d1b6..ea78a4b6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -9,16 +9,20 @@ public class MembershipService : IMembershipService private readonly IHttpContextAccessor contextAccessor; private readonly IEventLogService eventLogService; + private readonly ICookieAccessor cookieAccessor; + public MembershipService( UserManager userManager, SignInManager signInManager, IHttpContextAccessor contextAccessor, - IEventLogService eventLogService) + IEventLogService eventLogService, + ICookieAccessor cookieAccessor) { this.userManager = userManager; this.signInManager = signInManager; this.contextAccessor = contextAccessor; this.eventLogService = eventLogService; + this.cookieAccessor = cookieAccessor; } public async Task GetCurrentMember() @@ -61,5 +65,18 @@ public async Task SignIn(string userNameOrEmail, string password, } } - public async Task SignOut() => await signInManager.SignOutAsync(); + public async Task SignOut() + { + await signInManager.SignOutAsync(); + + RemoveCookies(); + } + + private void RemoveCookies() + { + cookieAccessor.Remove(CookieNames.CURRENT_CONTACT); + cookieAccessor.Remove(CookieNames.CMS_COOKIE_LEVEL); + cookieAccessor.Remove(CookieNames.COOKIE_ACCEPTANCE); + cookieAccessor.Remove(CookieNames.COOKIE_CONSENT_LEVEL); + } } \ No newline at end of file From 512b35bb015b551838d8028a92e0a039c8546808 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Thu, 14 Nov 2024 14:09:27 -0500 Subject: [PATCH 27/60] GH-89 :: Navigate to sign in page from button in the header if not signed in yet --- .../Header/HeaderViewComponentTests.cs | 43 +++++++++++++++++++ .../Features/Header/Header.cshtml | 21 ++++----- .../Features/Header/HeaderViewComponent.cs | 36 ++++++++++++++-- .../Features/Header/HeaderViewModel.cs | 5 ++- .../Services/ContentItemRetrieverService.cs | 29 +++++++++++-- .../Services/IContentItemRetrieverService.cs | 1 + src/TrainingGuides.Web/scss/_header.scss | 3 ++ src/TrainingGuides.Web/scss/_shared.scss | 2 - .../wwwroot/assets/css/styles.css | 4 ++ .../wwwroot/assets/css/styles.css.map | 2 +- .../wwwroot/assets/css/styles.min.css | 2 +- .../wwwroot/assets/css/styles.min.css.map | 2 +- 12 files changed, 124 insertions(+), 26 deletions(-) create mode 100644 src/TrainingGuides.Web.Tests/Features/Header/HeaderViewComponentTests.cs diff --git a/src/TrainingGuides.Web.Tests/Features/Header/HeaderViewComponentTests.cs b/src/TrainingGuides.Web.Tests/Features/Header/HeaderViewComponentTests.cs new file mode 100644 index 00000000..be19547f --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Header/HeaderViewComponentTests.cs @@ -0,0 +1,43 @@ +using Microsoft.Extensions.Localization; +using CMS.Websites; +using Moq; +using TrainingGuides.Web.Features.Header; +using TrainingGuides.Web.Features.Shared.Services; +using Xunit; + +namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.SignIn; + +public class HeaderViewComponentTests +{ + private readonly HeaderViewComponent viewComponent; + private readonly Mock> stringLocalizerMock; + private readonly Mock contentItemRetrieverServiceMock; + + private const string TRAINING_GUIDES = "Training guides"; + private const string SIGN_IN = "Sign in"; + private const string SIGN_OUT = "Sign out"; + + public HeaderViewComponentTests() + { + stringLocalizerMock = new Mock>(); + stringLocalizerMock.Setup(x => x[TRAINING_GUIDES]).Returns(new LocalizedString(TRAINING_GUIDES, TRAINING_GUIDES)); + stringLocalizerMock.Setup(x => x[SIGN_IN]).Returns(new LocalizedString(SIGN_IN, SIGN_IN)); + stringLocalizerMock.Setup(x => x[SIGN_OUT]).Returns(new LocalizedString(SIGN_OUT, SIGN_OUT)); + + contentItemRetrieverServiceMock = new Mock(); + + viewComponent = new HeaderViewComponent(stringLocalizerMock.Object, contentItemRetrieverServiceMock.Object); + } + + [Fact] + public void BuildViewModel_SetsUpWidgetProperties_ToShowSignInSignOutButton() + { + var testGuid = Guid.NewGuid(); + + var viewModel = viewComponent.BuildViewModel([new WebPageRelatedItem() { WebPageGuid = testGuid }]); + Assert.Equal(SIGN_IN, viewModel.LinkOrSignOutWidgetProperties.UnauthenticatedButtonText); + Assert.Equal(SIGN_OUT, viewModel.LinkOrSignOutWidgetProperties.AuthenticatedButtonText); + Assert.Single(viewModel.LinkOrSignOutWidgetProperties.UnauthenticatedTargetContentPage); + Assert.Equal(testGuid, viewModel.LinkOrSignOutWidgetProperties.UnauthenticatedTargetContentPage.First().WebPageGuid); + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Header/Header.cshtml b/src/TrainingGuides.Web/Features/Header/Header.cshtml index f89828c3..fc5d5af3 100644 --- a/src/TrainingGuides.Web/Features/Header/Header.cshtml +++ b/src/TrainingGuides.Web/Features/Header/Header.cshtml @@ -7,19 +7,14 @@ - -
- @{ - // Prepares properties for redering the "Link or sign out" widget - var widgetProperties = new LinkOrSignOutWidgetProperties() - { - UnauthenticatedButtonText = "Sign in", - UnauthenticatedTargetContentPage = Enumerable.Empty(), //TODO: retrieve and add the sign in page (by path?) - AuthenticatedButtonText = "Sign out" - }; - } - @* Renders the Form widget *@ - @await Html.Kentico().RenderStandaloneWidgetAsync(ComponentIdentifiers.Widgets.LINK_OR_SIGN_OUT, widgetProperties) +
+
+ +
+
+ @* Renders the Form widget *@ + @await Html.Kentico().RenderStandaloneWidgetAsync(ComponentIdentifiers.Widgets.LINK_OR_SIGN_OUT, Model.LinkOrSignOutWidgetProperties) +
diff --git a/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs b/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs index b91d6c70..dd274f25 100644 --- a/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs @@ -1,22 +1,50 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; +using TrainingGuides.Web.Features.Shared.Services; namespace TrainingGuides.Web.Features.Header; public class HeaderViewComponent : ViewComponent { private readonly IStringLocalizer stringLocalizer; - public HeaderViewComponent(IStringLocalizer stringLocalizer) + private readonly IContentItemRetrieverService contentItemRetrieverService; + + public HeaderViewComponent( + IStringLocalizer stringLocalizer, + IContentItemRetrieverService contentItemRetrieverService) { this.stringLocalizer = stringLocalizer; + this.contentItemRetrieverService = contentItemRetrieverService; + } + + public async Task InvokeAsync() + { + var model = BuildViewModel(await GetSignInPage()); + return View("~/Features/Header/Header.cshtml", model); } - public IViewComponentResult Invoke() + private async Task> GetSignInPage() + { + const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; + var page = await contentItemRetrieverService.RetrieveWebPageByPath(EXPECTED_SIGN_IN_PATH); + + return page != null + ? [new WebPageRelatedItem() { WebPageGuid = page.SystemFields.WebPageItemGUID }] + : Enumerable.Empty(); + } + public HeaderViewModel BuildViewModel(IEnumerable signInPage) { var model = new HeaderViewModel() { - Heading = stringLocalizer["Training guides"] + Heading = stringLocalizer["Training guides"], + LinkOrSignOutWidgetProperties = new() + { + UnauthenticatedButtonText = stringLocalizer["Sign in"], + UnauthenticatedTargetContentPage = signInPage, + AuthenticatedButtonText = stringLocalizer["Sign out"] + } }; - return View("~/Features/Header/Header.cshtml", model); + + return model; } } diff --git a/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs b/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs index e7f69b03..be6d251a 100644 --- a/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs +++ b/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs @@ -1,6 +1,9 @@ -namespace TrainingGuides.Web.Features.Header; +using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; + +namespace TrainingGuides.Web.Features.Header; public class HeaderViewModel { public string Heading { get; set; } = string.Empty; + public LinkOrSignOutWidgetProperties LinkOrSignOutWidgetProperties { get; set; } = new(); } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs index 6746c950..675d1e32 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs @@ -245,13 +245,17 @@ public async Task> RetrieveContentItemsByS return await RetrieveContentItems(contentQueryParameters, contentTypesQueryParameters); } - private async Task> RetrieveWebPages(Action parameters) + private async Task> RetrieveWebPages(Action parameters, string? pathToMatch = null) { var builder = new ContentItemQueryBuilder(); - builder.ForContentTypes(query => + builder + .ForContentTypes(query => { - query.ForWebsite(websiteChannelContext.WebsiteChannelName); + if (pathToMatch == null) + query.ForWebsite(websiteChannelContext.WebsiteChannelName); + else + query.ForWebsite(websiteChannelContext.WebsiteChannelName, PathMatch.Single(pathToMatch)); }) .Parameters(parameters); @@ -289,4 +293,23 @@ private async Task> RetrieveWebPages(Action + /// Retrieves the IWebPageFieldsSource of a web page item by path. + /// + /// the path of the web page item + /// object containing generic for the item + public async Task RetrieveWebPageByPath(string pathToMatch) + { + var builder = new ContentItemQueryBuilder(); + + builder.ForContentTypes(query => + { + query.ForWebsite(websiteChannelContext.WebsiteChannelName, PathMatch.Single(pathToMatch)); + }); + + var pages = await contentQueryExecutor.GetMappedResult(builder); + + return pages.FirstOrDefault(); + } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs index cf347136..a31059ea 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs @@ -48,4 +48,5 @@ public Task> RetrieveContentItemsBySchemaA string schemaName, string taxonomyColumnName, IEnumerable tagGuids); + public Task RetrieveWebPageByPath(string pathToMatch); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/scss/_header.scss b/src/TrainingGuides.Web/scss/_header.scss index a34b5cee..303621ac 100644 --- a/src/TrainingGuides.Web/scss/_header.scss +++ b/src/TrainingGuides.Web/scss/_header.scss @@ -158,4 +158,7 @@ .c-header-alert .btn-close { right: 3.625rem; } +} +.dropdown { + top: 25%; } \ No newline at end of file diff --git a/src/TrainingGuides.Web/scss/_shared.scss b/src/TrainingGuides.Web/scss/_shared.scss index 74fd0336..a4383cb5 100644 --- a/src/TrainingGuides.Web/scss/_shared.scss +++ b/src/TrainingGuides.Web/scss/_shared.scss @@ -188,8 +188,6 @@ .tg-col { flex: 1; } - .tg-pb-col { padding: 2rem; - } \ No newline at end of file diff --git a/src/TrainingGuides.Web/wwwroot/assets/css/styles.css b/src/TrainingGuides.Web/wwwroot/assets/css/styles.css index 050c9e28..5750c33b 100644 --- a/src/TrainingGuides.Web/wwwroot/assets/css/styles.css +++ b/src/TrainingGuides.Web/wwwroot/assets/css/styles.css @@ -1026,6 +1026,10 @@ right: 3.625rem; } } +.dropdown { + top: 25%; +} + .c-why_heading { color: #1e1a1b; } diff --git a/src/TrainingGuides.Web/wwwroot/assets/css/styles.css.map b/src/TrainingGuides.Web/wwwroot/assets/css/styles.css.map index 388941c8..9bd1ea64 100644 --- a/src/TrainingGuides.Web/wwwroot/assets/css/styles.css.map +++ b/src/TrainingGuides.Web/wwwroot/assets/css/styles.css.map @@ -1 +1 @@ -{"version":3,"sources":["../../../scss/_article.scss","styles.css","../../../scss/_variables.scss","../../../scss/_button.scss","../../../scss/_mixins.scss","../../../scss/_card.scss","../../../scss/_data-protection.scss","../../../scss/_font.scss","../../../scss/_footer.scss","../../../scss/_form.scss","../../../scss/_header.scss","../../../scss/_product.scss","../../../scss/_shared.scss","../../../scss/_section.scss"],"names":[],"mappings":"AAEA;;EAEI,mBAAA;ACDJ;;ADIA;;EAEI,mBAAA;ACDJ;;ADIA;EACI,uBAAA;ACDJ;;ADIA;EACI,oBAAA;EACA,uBAAA;ACDJ;;ADIA;EACI,WAAA;EACA,mCAAA;EACA,uBAAA;EACA,mBEzBY;EF0BZ,YEvBU;EFwBV,kBAAA;EACA,kBAAA;EACA,YAAA;EACA,cAAA;EACA,gBAAA;ACDJ;;ADIA;EACI,eAAA;EACA,gBAAA;ACDJ;;ADIA;EACI,mBAAA;ACDJ;;ADIA;E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EACA,mBXxGI;ADixDhB;AYtqDQ;EACI,YAAA;EACA,8BAAA;EACA,yBAAA;AZwqDZ;AYrqDQ;EACI,YX/GE;EWgHF,yBX5GC;ADmxDb;AYnqDI;EACI;IACI,eAAA;EZqqDV;EYlqDM;IACI,mBAAA;EZoqDV;AACF;AYjqDI;EACI,eAAA;EACA,gBAAA;EACA,iCAAA;EACA,0BAAA;AZmqDR;AYhqDI;EAGI,iBAAA;AZgqDR;AY7pDI;EACI,cAAA;AZ+pDR;AY5pDI;EACI;IACI,eAAA;IACA,aAAA;IACA,2BAAA;IACA,yBAAA;EZ8pDV;EY3pDM;IAGI,iBAAA;EZ2pDV;AACF;AYxpDI;EACI;IACI,eAAA;EZ0pDV;EYvpDM;IAGI,iBAAA;EZupDV;AACF;AYppDI;EACI;IACI,gBAAA;IACA,yBAAA;EZspDV;AACF;AYnpDI;EACI;IACI,yBAAA;EZqpDV;AACF;AYlpDI;EACI,iBAAA;EACA,aAAA;EACA,oBAAA;EACA,uBAAA;AZopDR;AYjpDI;EACI;IACI,gEAAA;IACA,sBAAA;IACA,eAAA;IACA,mBAAA;EZmpDV;AACF;AYhpDI;EACI,mBX1MU;EW2MV,mBXhMwB;EWiMxB,mBAAA;EACA,sBAAA;AZkpDR;AY/oDI;EACI,gBAAA;AZipDR;AY9oDI;EACI,mBXtNQ;EWuNR,mBX3MwB;EW4MxB,mBAAA;EACA,sBAAA;AZgpDR;AY7oDI;EACI,gBAAA;AZ+oDR;AY5oDI;EACI,mBX7NgB;EW8NhB,mBXtNwB;EWuNxB,mBAAA;EACA,sBAAA;AZ8oDR;AY3oDI;EACI,gBAAA;AZ6oDR","file":"styles.css"} \ No newline at end of file +{"version":3,"sources":["../../../scss/_article.scss","styles.css","../../../scss/_variables.scss","../../../scss/_button.scss","../../../scss/_mixins.scss","../../../scss/_card.scss","../../../scss/_data-protection.scss","../../../scss/_font.scss","../../../scss/_footer.scss","../../../scss/_form.scss","../../../scss/_header.scss","../../../scss/_product.scss","../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R;AYlpDI;EACI,mBXtNQ;EWuNR,mBX3MwB;EW4MxB,mBAAA;EACA,sBAAA;AZopDR;AYjpDI;EACI,gBAAA;AZmpDR;AYhpDI;EACI,mBX7NgB;EW8NhB,mBXtNwB;EWuNxB,mBAAA;EACA,sBAAA;AZkpDR;AY/oDI;EACI,gBAAA;AZipDR","file":"styles.css"} \ No newline at end of file diff --git a/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css b/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css index 4f39d374..a56f1edb 100644 --- a/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css +++ b/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css @@ -1 +1 @@ -.c-post h1,.c-post .h1{font-size:1.875rem}.c-post h2,.c-post .h2{font-size:1.625rem}.c-post_body{margin:2.5rem 1.5rem 0}.c-post_body p{margin-top:1.625rem;margin-bottom:1.625rem}.c-post_quote{float:left;margin:.375rem 1.875rem 1.25rem 0;padding:1.75rem 1.5rem;background:#8107c1;color:#fff;font-size:1.25rem;text-align:center;width:190px;max-width:50%;font-weight:500}.c-post_quote_ico{font-size:3rem;line-height:.7}.c-post-thumbnail{font-size:1.125rem}.c-post-thumbnail_ico{width:7.5rem;height:7.5rem}.c-post-thumbnail.default .c-card{padding:2.25rem 2rem 2rem}.c-post-thumbnail.bg .c-card{display:flex;flex-direction:column;justify-content:space-between;align-items:center;min-height:28rem;background:no-repeat center center;background-size:cover;padding:2.25rem 2rem 2rem;position:relative;overflow:hidden}.c-post-thumbnail.bg .c-card:before{content:"";display:block;position:absolute;inset:0;background:#000;opacity:.3}.c-post-thumbnail.bg .c-card>*{z-index:1}.j-truncate_heading,.j-truncate_paragraph{max-height:5.25rem;text-overflow:ellipsis;overflow:hidden;display:-webkit-box !important;-webkit-line-clamp:3;-webkit-box-orient:vertical;white-space:normal}.btn .c-icon{font-size:1.25rem;margin-top:-3px}.btn-lg .c-icon,.btn-group-lg>.btn .c-icon{font-size:1.375rem;margin-right:.25rem;margin-top:0}.btn-social .c-icon{font-size:1.5rem;margin-top:0}.tg-btn-primary{background-color:#8107c1 !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.tg-btn-secondary{background-color:#f0561a !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-primary,.btn.tg-bg-primary:hover{background-color:#8107c1 !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-secondary,.btn.tg-bg-secondary:hover{background-color:#f0561a !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-none,.btn.tg-bg-none:hover{background-color:none !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-light-1,.btn.tg-bg-light-1:hover{background-color:#fff !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-light-2:hover{background-color:#efe6f9 !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-light-3,.btn.tg-bg-light-3:hover{background-color:#ebf5ff !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-txt-light,.btn.tg-txt-light:hover{color:#fff !important}.btn.tg-txt-medium,.btn.tg-txt-medium:hover{color:#f0561a !important}.btn.tg-txt-dark,.btn.tg-txt-dark:hover{color:#1e1a1b !important}.c-card{display:flex;flex-direction:column;justify-content:space-between;color:#1e1a1b}.c-card.sm{padding:1rem 1.25rem}.c-card.md{padding:1rem}.c-card.lg{padding:1.5rem 1rem}.c-card.bg-1{background:#efe6f9}.c-card.bg-1 .c-card.bg-1{background:#fff}.c-card.bg-2{background:#f0561a}.c-card.bg-2 .c-card.bg-2{background:#fff}@media(min-width: 768px){.c-card.md{padding:1.5rem}.c-card.lg{padding:2.5rem}}.c-card.home{position:relative;padding:1.5rem 1rem}.c-card.home p{margin-top:1.2rem;height:auto;overflow:hidden}.c-card.home .c-card_img{flex-grow:1;flex-shrink:1;position:relative}.c-card.home .c-card_img img{position:absolute;inset:0;height:100%;width:100%;-o-object-fit:cover;object-fit:cover}@media(min-width: 992px){.c-card.home{padding:1.75rem 1.875rem;height:25rem}}.c-card-wrapper{padding:2rem 1rem;background-color:#efe6f9}.c-card-wrapper .c-card-home_content-01{background-color:#f3f4f5}@media(min-width: 768px){.c-card-wrapper{padding:2rem 1.5rem}}@media(min-width: 992px){.c-card-wrapper{padding:2rem 3rem}}.c-card-anchor{text-decoration:none}.c-card-anchor .c-card.bg-1{background-color:#efe6f9;transition:transform .3s,box-shadow .5s,background-color .3s ease-in-out}.c-card-anchor:hover .c-card.bg-1{background-color:#ebd8ff}.xpcookiebanner{width:100%;background-color:#fff;padding:16px 0;z-index:110;transform:translateY(100%);min-height:260px;color:#231f20;border-bottom:4px solid #7f09b7;display:none}.xpcookiebanner.is-active{display:flex;transform:translateY(0%)}.xpcookiebanner__inner{display:flex;align-items:flex-start;justify-content:space-between;flex-direction:column}@media(min-width: 768px){.xpcookiebanner__inner{flex-direction:row;align-items:center}}.xpcookiebanner__inner p,.xpcookiebanner__inner a{color:#000;margin:0;font-size:12px}@media(min-width: 568px){.xpcookiebanner__inner p,.xpcookiebanner__inner a{font-size:14px}}@media(min-width: 768px){.xpcookiebanner__inner p,.xpcookiebanner__inner a{font-size:16px}}.xpcookiebanner__header{width:100%;font-size:18px;font-weight:bold;margin:8px 16px 8px 0}@media(max-width: 567.98px){.xpcookiebanner__header{margin:16px 0 16px 0}}@media(max-width: 767.98px){.xpcookiebanner__header{margin:16px 32px 16px 0;font-size:30px}}.xpcookiebanner__header:after{content:""}.xpcookiebanner__ctas{display:flex;flex-direction:row;align-items:center;white-space:nowrap;margin-top:16px}@media(min-width: 568px){.xpcookiebanner__ctas{margin-top:0;margin-left:32px}}@media(min-width: 768px){.xpcookiebanner__ctas .btn{font-size:14px;padding-left:16px;padding-right:16px}}.xpcookiebanner__cta+.xpcookiebanner__cta{margin-top:0;margin-left:16px}.xpcookiebanner__message{font-size:0}.js-header--xpcookiebanner-is-active{margin-top:260px;top:260px}@media(max-width: 767.98px){.js-header--xpcookiebanner-is-active .nav .nav__inner{height:calc(100% - 260px);top:260px}}.cookie-preferences__levels{display:flex;flex-direction:column;min-height:400px}@media(max-width: 567.98px){.cookie-preferences__levels{min-height:350px}}.cookie-preferences__options{position:relative;margin:0;padding:0;list-style:none;min-height:300px;margin-top:-20.5px;margin-left:-16px}.cookie-preferences__options .cookie-preferences__option{color:#000;font-size:14px;cursor:pointer;padding-inline-start:11px;margin-bottom:10px}.cookie-preferences__options .cookie-preferences__option:nth-child(2){top:90px}.cookie-preferences__options .cookie-preferences__option:nth-child(3){top:180px}.cookie-preferences__options .cookie-preferences__option:nth-child(4){top:280px}.cookie-preferences__options .cookie-preferences__option:before{content:"";background:#908e8f;font-size:9px;border-radius:100%;padding-inline:5px;margin-inline-end:24px}.cookie-preferences__options .cookie-preferences__option--selected{font-weight:bold}.cookie-preferences__options .cookie-preferences__option-header{display:inline-block;font-weight:bold;margin-bottom:6px;font-size:15px}@media(min-width: 568px){.cookie-preferences__options .cookie-preferences__option-header{font-size:16px}}@media(min-width: 768px){.cookie-preferences__options .cookie-preferences__option-header{font-size:20px}}.cookie-preferences__options .cookie-preferences__option-description{display:block;padding-inline-start:32px;font-size:12px}@media(min-width: 568px){.cookie-preferences__options .cookie-preferences__option-description{font-size:14px}}@media(min-width: 768px){.cookie-preferences__options .cookie-preferences__option-description{font-size:16px}}.cookie-preferences__selector{position:relative;display:inline-block;width:300px;height:41px;transform:rotate(90deg);transform-origin:left;z-index:8}.cookie-preferences__range-fill{position:absolute;box-sizing:border-box;display:inline-block;left:5px;top:15.5px;border-radius:8px;border-top-right-radius:0;border-bottom-right-radius:0;width:calc(100% - 5px);height:10px;background:#f0561a}.cookie-preferences__range-slider{position:absolute;top:0;left:0px;-webkit-appearance:none;width:300px;height:41px;background:rgba(0,0,0,0);padding:0;box-sizing:border-box;cursor:pointer}.cookie-preferences__range-slider::-webkit-slider-thumb{-webkit-appearance:none}.cookie-preferences__range-slider::-ms-track{width:300px;cursor:pointer;background:rgba(0,0,0,0);border-color:rgba(0,0,0,0);color:rgba(0,0,0,0)}.cookie-preferences__range-slider:focus{outline:none}.cookie-preferences__range-slider::-moz-focus-outer{border:0}.cookie-preferences__range-slider::-webkit-slider-thumb{-webkit-appearance:none;border:3px solid #fff;height:30px;width:30px;border-radius:50%;background:#f0561a;cursor:pointer;margin-top:-10px}.cookie-preferences__range-slider::-webkit-slider-runnable-track{width:300px;height:10px;cursor:pointer;background:rgba(0,0,0,0)}.cookie-preferences__range-slider::-moz-range-thumb{border:3px solid #fff;height:30px;width:30px;border-radius:50%;background:#f0561a;cursor:pointer}.cookie-preferences__range-slider::-moz-range-track{box-sizing:border-box;width:300px;height:10px;cursor:pointer;background:rgba(0,0,0,0)}@media all and (-ms-high-contrast: none),(-ms-high-contrast: active){.cookie-preferences__range-fill{display:none}}.cookie-preferences__range-slider::-ms-thumb{box-shadow:0 0 0 3px #fff;height:30px;width:30px;border-radius:50%;background:#f0561a;cursor:pointer;margin-top:2px;box-sizing:border-box;border:0}.cookie-preferences__range-slider:focus::-ms-thumb{border:0}.cookie-preferences__range-slider::-ms-track{width:300px;height:10px;cursor:pointer;background:rgba(0,0,0,0);color:rgba(0,0,0,0);box-sizing:border-box}.cookie-preferences__range-slider::-ms-fill-lower{background:#f0561a}.cookie-preferences__range-slider::-ms-fill-upper{background:rgba(0,0,0,0)}.cookie-preferences__range-slider::-ms-tooltip{display:none}.cookie-preferences__message{margin-top:16px;margin-bottom:16px}@font-face{font-family:"GT Walsheim Pro";src:url("../font/GTWalsheimPro-Regular.eot");src:local("GT Walsheim Pro Regular"),local("GTWalsheimPro-Regular"),url("https://download.kentico.com/Assets/GT-Walsheim-Regular.woff") format("woff"),url("../font/GTWalsheimPro-Regular.eot?#iefix") format("embedded-opentype"),url("../font/GTWalsheimPro-Regular.woff2") format("woff2"),url("../font/GTWalsheimPro-Regular.ttf") format("truetype");font-weight:normal;font-style:normal}@font-face{font-family:"GT Walsheim Pro";src:url("../font/GTWalsheimPro-Bold.eot");src:local("GT Walsheim Pro Bold"),local("GTWalsheimPro-Bold"),url("https://download.kentico.com/Assets/GT-Walsheim-Bold.woff") format("woff"),url("../font/GTWalsheimPro-Bold.eot?#iefix") format("embedded-opentype"),url("../font/GTWalsheimPro-Bold.woff2") format("woff2"),url("../font/GTWalsheimPro-Bold.ttf") format("truetype");font-weight:bold;font-style:normal}@font-face{font-family:"GT Walsheim Pro";src:url("../font/GTWalsheimPro-Medium.eot");src:local("GT Walsheim Pro Medium"),local("GTWalsheimPro-Medium"),url("https://download.kentico.com/Assets/GT-Walsheim-Medium.woff") format("woff"),url("../font/GTWalsheimPro-Medium.eot?#iefix") format("embedded-opentype"),url("../font/GTWalsheimPro-Medium.woff2") format("woff2"),url("../font/GTWalsheimPro-Medium.ttf") format("truetype");font-weight:500;font-style:normal}@font-face{font-family:"Vollkorn";src:url("../font/Vollkorn-Regular.eot");src:local("Vollkorn Regular"),local("Vollkorn-Regular"),url("../font/Vollkorn-Regular.eot?#iefix") format("embedded-opentype"),url("../font/Vollkorn-Regular.woff") format("woff"),url("../font/Vollkorn-Regular.ttf") format("truetype");font-weight:normal;font-style:normal}@font-face{font-family:"Vollkorn";src:url("../font/Vollkorn-Bold.eot");src:local("Vollkorn Bold"),local("Vollkorn-Bold"),url("../font/Vollkorn-Bold.eot?#iefix") format("embedded-opentype"),url("../font/Vollkorn-Bold.woff") format("woff"),url("../font/Vollkorn-Bold.ttf") format("truetype");font-weight:bold;font-style:normal}@font-face{font-family:"Vollkorn";src:url("../font/Vollkorn-Medium.eot");src:local("Vollkorn Medium"),local("Vollkorn-Medium"),url("../font/Vollkorn-Medium.eot?#iefix") format("embedded-opentype"),url("../font/Vollkorn-Medium.woff") format("woff"),url("../font/Vollkorn-Medium.ttf") format("truetype");font-weight:500;font-style:normal}.c-footer{background:#ebf5ff;padding:2.5rem 1rem 1.25rem;text-align:center;position:relative;overflow:hidden}.c-footer .navbar-brand{display:block}.c-footer .nav{justify-content:end}.c-footer .nav-link{font-size:1rem;font-weight:400;padding:0}.c-footer .nav-item{display:flex;align-items:center;padding:0 0 0 1rem}.c-footer .c-note{font-size:.75rem}.c-footer_circle{position:absolute;top:-20%;left:93%;padding:15%;border:1px solid #f0561a;background-color:#f0561a}@media(min-width: 568px){.c-footer{padding:2rem 1rem 2.25rem}.c-footer .navbar-brand{margin-top:.625rem;text-align:left}.c-footer .nav{justify-content:flex-end;margin-top:0}.c-footer .c-note{text-align:right}}@media(min-width: 992px){.c-footer .navbar-brand{margin-top:.5rem}}.c-footer .c-divider{border-bottom:2px solid #cfc9ca;padding-bottom:2rem}@media(max-width: 767.98px){.c-footer-grid{display:grid;grid-template-columns:repeat(2, 1fr)}.c-footer-grid .grid-item:nth-of-type(1){order:1}.c-footer-grid .grid-item:nth-of-type(2){order:3}.c-footer-grid .grid-item:nth-of-type(3){order:2}.c-footer-grid .grid-item:nth-of-type(4){order:4}}.c-list-footer{text-align:start;padding:0}.c-list-footer_item{list-style:none;padding:.25rem 0}.c-list-footer_item a{text-decoration:none;color:#231f20;font-weight:500}.c-list-footer_item h2,.c-list-footer_item .h2{font-size:.75rem;margin-bottom:0;padding-bottom:.2rem}.form form{display:grid}.form form input[type=submit]{background-color:#f0561a !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.form form input[type=submit]:hover{background-color:#f0561a;border-color:#f0561a;color:#fff;border:none}.form form .form-field{margin:1rem 0;position:relative}.form form .form-field .control-label{margin-bottom:.375rem;font-size:.875rem;font-weight:700}.form form .form-field .field-validation-error{position:absolute;bottom:-17px;left:20px;color:#b72929;font-size:.75rem;font-weight:700}.form .formwidget-submit-text{text-align:center;margin:2rem 0;font-weight:700}.c-header{background:#fff;transition:.2s box-shadow;border-bottom:1px solid rgba(206,212,218,.5)}.c-header.scrolled{box-shadow:0 8px 32px rgba(16,33,60,.24),0 0 8px rgba(0,0,0,.03);border-bottom:none}.c-header .navbar-toggler{margin-bottom:.75rem;margin-left:1rem;margin-right:-1rem}.c-header #sign-in-tablet{display:none;margin:0 0 .75rem auto}@media(min-width: 400px)and (max-width: 767.98px){.c-header #sign-in-tablet{display:block}.c-header .nav-item.with-btn{display:none}}@media(max-width: 991.98px){.c-header .c-main-navbar{padding-top:1rem;padding-bottom:.875rem}}@media(max-width: 767.98px){.c-header:after{content:"";display:block;position:absolute;top:4.5rem;left:0;right:0;height:0;border-top:1px solid rgba(144,142,143,.5);opacity:0;transition:.15s opacity}.c-header.mobile-nav-open{box-shadow:0 8px 32px rgba(16,33,60,.24),0 0 8px rgba(0,0,0,.03)}.c-header.mobile-nav-open:after{opacity:1}.c-header.mobile-nav-open .c-subnav,.c-header.mobile-nav-open .c-subnav-alt{margin-top:-4rem}.c-header .c-main-navbar{padding-bottom:0;padding-top:.625rem}.c-header .navbar-brand{margin-bottom:1rem;margin-top:.25rem}}@media(min-width: 768px){.c-header .navbar-brand.c-circle-logo{border-radius:50%;height:10rem;width:10rem;border:1px solid rgba(206,212,218,.5);position:absolute;top:1.625rem;background:#fff}.c-header .navbar-brand.c-circle-logo img{transform:rotate(90deg);position:absolute;inset:10%;margin:auto;max-width:80%;max-height:80%}}@media(min-width: 992px){.c-header .c-main-navbar{padding-bottom:1.375rem}}.c-header-alert{background:#f05a22;color:#fff;position:relative;font-size:.875rem}.c-header-alert_inner{padding:.5rem 1.25rem .5rem .25rem}.c-header-alert .btn-close{position:absolute;top:.5rem;right:.5rem}.c-header-alert p a{color:#fff}.c-header-alert p a:hover{text-decoration:none}@media(min-width: 568px){.c-header-alert_inner{padding:.5rem 1.5rem .5rem 1.25rem}}@media(min-width: 768px){.c-header-alert_inner{padding:.75rem 1.5rem .75rem 1.25rem}.c-header-alert .btn-close{top:.75rem;right:.75rem}}@media(min-width: 992px){.c-header-alert{text-align:center}}@media(min-width: 1400px){.c-header-alert{font-size:1.125rem}.c-header-alert .btn-close{right:3.625rem}}.c-why_heading{color:#1e1a1b}.c-products-grid{margin-left:-1rem;margin-right:-1rem;position:relative;z-index:1}.c-products-grid:before,.c-products-grid:after{content:"";display:block;position:absolute;background:#efe6f9;z-index:1}.c-products-grid:before{inset:0 auto 2rem 0;width:36vw}.c-products-grid_inner{position:relative;margin-bottom:1rem;padding-bottom:3rem;overflow:auto;scrollbar-color:#8107c1 #fff}.c-products-grid_inner::-webkit-scrollbar{width:6px;height:6px}.c-products-grid_inner::-webkit-scrollbar-track{margin:0 50px;background:#fff}.c-products-grid_inner::-webkit-scrollbar-thumb{background:#8107c1}.c-products-grid_scrollable{width:-moz-max-content;width:max-content}.c-products-grid_bg{position:absolute;top:0;bottom:3rem;background:#fff;border-radius:2rem;width:46vw;margin-left:-1vw;z-index:-1}.c-products-grid_bg.highlight{box-shadow:0 0 2vw 0 #f0561a}.c-products-grid_row{display:flex;justify-content:flex-start;padding:0 0 0 2vw;background:rgba(0,0,0,0);transition:.2s background-color ease}.c-products-grid_row.no-hover .c-products-grid_col{position:static}.c-products-grid_row.no-hover .c-products-grid_col:before{content:"";display:none}.c-products-grid_row.no-hover .c-products-grid_col.gap,.c-products-grid_row.no-hover .c-products-grid_col.th{position:sticky}.c-products-grid_row:first-child .c-products-grid_col{align-items:flex-end;padding:1.5rem 0 1rem}.c-products-grid_row:last-child .c-products-grid_col{border-bottom:none}.c-products-grid_row.shortDescription .c-products-grid_col{border-bottom:none}.c-products-grid_col{position:relative;display:flex;flex-grow:0;flex-shrink:0;align-items:center;justify-content:center;width:42vw;padding:1.25rem 0;min-height:3.5rem;border-bottom:1px solid #f0f0f2;text-align:center;margin:0 4vw;font-size:1.125rem;color:#1e1a1b}.c-products-grid_col:before{content:"";display:block;position:absolute;inset:0;background:rgba(0,0,0,0);transition:.2s background-color ease;z-index:-1}.c-products-grid_col.th{width:34vw;text-align:left;justify-content:flex-start;border-bottom:1px solid #f0561a;margin:0;padding:1.25rem 0;font-size:1rem;position:sticky;left:2vw;z-index:1;color:inherit}.c-products-grid_col.th:before{inset:0}.c-products-grid_col.gap{width:1vw;border-bottom:none;margin:0;padding:0;position:sticky;right:0;z-index:1;background:#efe6f9}.c-products-grid_col.gap:before{content:none;display:none}.c-products-grid_col h3,.c-products-grid_col .h3,.c-products-grid_col h4,.c-products-grid_col .h4{margin-bottom:0}.c-products-grid_col:nth-last-child(2){margin-right:22px}.c-products-grid_del-price{color:#8107c1}.c-products-grid_check{color:#f0561a}.c-products-grid .accordion-button{--bs-accordion-btn-padding-x: 0;--bs-accordion-btn-padding-y: .5rem}@media(min-width: 568px){.c-products-grid{margin-left:-1rem;margin-right:-1rem}.c-products-grid:before{width:204px}.c-products-grid_bg{width:240px;margin-left:-15px}.c-products-grid_bg.highlight{box-shadow:0 0 20px 0 #f0561a}.c-products-grid_row{padding:0 0 0 24px}.c-products-grid_col{width:210px;margin:0 30px;min-height:4rem}.c-products-grid_col.th{width:180px;margin:0 12px 0 0;left:24px}.c-products-grid_col.gap{width:30px;margin:0 0 0 -2px}}@media(min-width: 768px){.c-products-grid{margin-left:-2.5rem;margin-right:-2.5rem}.c-products-grid:before{width:276px}.c-products-grid_bg{width:300px;margin-left:-15px}.c-products-grid_bg.highlight{box-shadow:0 0 30px 0 #f0561a}.c-products-grid_row:hover .c-products-grid_col:before{background:rgba(0,0,0,.05)}.c-products-grid_col{width:270px;margin:0 30px;min-height:4rem}.c-products-grid_col.th{width:236px;margin:0 30px 0 0;left:36px;padding:1.25rem 1rem}.c-products-grid_col.gap{width:30px;margin:0 0 0 -2px}.c-products-grid_col:before{inset:0 -15px}}@media(min-width: 992px){.c-products-grid_bg{width:250px}.c-products-grid_col{width:220px;margin:0 30px;min-height:4rem}}@media(min-width: 1200px){.c-products-grid:before{width:282px}.c-products-grid_bg{width:224px;margin-left:-20px}.c-products-grid_bg.highlight{box-shadow:0 0 30px 0 #f0561a}.c-products-grid_row{padding:0 0 0 58px}.c-products-grid_col{width:184px;min-height:5rem}.c-products-grid_col.th{width:224px;left:58px;margin:0 15px 0 0}.c-products-grid_col:nth-last-child(2){margin-right:22px}.c-products-grid_col:before{inset:0 -20px}}.c-product-img{max-width:35rem;max-height:20rem}.c-pricelist{padding:1.5rem 1rem}.c-pricelist_text{margin-top:1.5rem;display:flex;flex-direction:column;justify-content:center}.c-pricelist_price{color:#f0561a}.c-pricelist_heading{color:#1e1a1b}.c-pricelist .c-table{padding:1rem;border:solid 1px #a0a0a2;margin:0 4rem}.c-pricelist .c-table_row{border-top:1px solid #f0f0f2;align-items:center}.c-pricelist .c-table_row:last-child{border-bottom:1px solid #f0f0f2}.c-pricelist .c-table_cell{padding:.375rem}@media(max-width: 567.98px){.c-pricelist .c-table_cell:first-child{padding-left:0}.c-pricelist .c-table_cell:last-child{padding-right:0}}.c-pricelist.compact{padding:0;background:0}.c-pricelist.compact .c-table{padding:.5rem .75rem}.c-pricelist.compact .c-table_row{flex-direction:column;align-items:flex-start}.c-pricelist.compact .c-table_row:first-child{border-top:0}.c-pricelist.compact .c-table_row:last-child{border-bottom:0}.c-pricelist.compact .c-table_cell{padding:0 .75rem}.c-pricelist.compact .c-table_cell.light{opacity:.7}.c-pricelist.compact .c-table_cell:first-child{padding-top:.5rem}.c-pricelist.compact .c-table_cell:last-child{padding-bottom:.5rem}.c-table_row{display:flex;justify-content:space-between}@media(min-width: 568px){.c-pricelist{margin-top:0}.c-pricelist_text{margin-top:0}.c-pricelist .c-table{font-size:1rem;padding:1.5rem 1rem}}@media(min-width: 768px){.c-pricelist{padding:2.5rem}.c-pricelist .c-table{padding:1.75rem}.c-pricelist .c-table_cell{padding:.625rem .75rem}}@media(min-width: 1200px){.c-pricelist{padding:4rem}.c-pricelist .c-table{padding:2rem}}.tg-product img.tg-product_img{-o-object-fit:cover;object-fit:cover}.tg-product .tg-product_benefits{display:flex}.tg-product .align-left{text-align:left}.tg-product .align-left .tg-product_benefits{flex-direction:row}.tg-product .align-center{text-align:center}.tg-product .align-center .tg-product_benefits{text-align:left;flex-direction:row}.tg-product .align-right{text-align:right}.tg-product .align-right .tg-product_benefits{flex-direction:row-reverse}.tg-product a:link,.tg-product a:visited,.tg-product a:hover,.tg-product a:active{text-decoration:none;color:inherit}.tg-product.tg-layout-full-width img.tg-product_img{max-height:10rem;width:100%}.tg-product.tg-layout-ascending,.tg-product.tg-layout-descending{position:relative;padding:1rem;background-color:rgba(0,0,0,0) !important}.tg-product.tg-layout-ascending .tg-product_main,.tg-product.tg-layout-descending .tg-product_main{width:65%;margin-top:35% !important;position:relative;z-index:10}.tg-product.tg-layout-ascending img.tg-product_img,.tg-product.tg-layout-descending img.tg-product_img{position:absolute;width:65%;max-height:100%;-o-object-fit:cover;object-fit:cover;top:0}.tg-product.tg-layout-ascending img.tg-product_img{right:0}.tg-product.tg-layout-ascending .tg-product_main{margin-left:0 !important;margin-right:auto !important}.tg-product.tg-layout-descending img.tg-product_img{left:0}.tg-product.tg-layout-descending .tg-product_main{margin-left:auto !important;margin-right:0 !important}.tg-product.tg-layout-image-left,.tg-product.tg-layout-image-right{background-color:rgba(0,0,0,0) !important}.tg-product.tg-layout-image-left .tg-product_main,.tg-product.tg-layout-image-right .tg-product_main{width:100%;margin:0 !important}.tg-product.tg-layout-image-left img.tg-product_img,.tg-product.tg-layout-image-right img.tg-product_img{max-width:80%;overflow:hidden}.tg-product.tg-layout-image-left .tg-row{flex-direction:row-reverse}.t-default{background:#fff;color:#1e1a1b;--bs-body-font-family: "GT Walsheim Pro", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif}.content-wrapper{min-height:calc(100vh - 12.5rem)}@media(min-width: 1200px){.content-wrapper{min-height:calc(100vh - 14rem)}}.c-circle{position:absolute;border-radius:50%}.u-border-01{border:none;border-radius:2rem}.u-border-02{border:none;border-radius:2rem}.c-img-placeholder.type01{width:5rem;height:4rem}.c-img-placeholder.type02{width:3rem;height:2.5rem}.c-icon{display:inline-block;height:1em;width:1em;vertical-align:top}.c-icon-box{display:grid;grid-template-columns:1.5rem 1fr;gap:.75rem}.c-icon-box_icon{color:#8107c1}.c-icon-box_icon .c-icon{width:1.5rem;height:1.5rem}.c-link.basic{color:inherit;text-decoration:underline}.c-link.basic:hover,.c-link.basic:focus{color:inherit;text-decoration:none}.c-link.silent{color:inherit;text-decoration:none}.c-link.silent:hover,.c-link.silent:focus{color:inherit;text-decoration:underline}.c-link.primary-upper{color:#8107c1;font-weight:500;text-transform:uppercase;text-decoration:none;transition:.15s color ease}.c-link.primary-upper .c-icon{width:.875rem;height:.875rem;vertical-align:baseline}.c-link.primary-upper:hover,.c-link.primary-upper:focus{color:#8107c1}.c-link.primary-upper:active{color:#8107c1}.c-date{font-size:.875rem;margin:.6rem 0;color:#f0561a}.tg-corner-shrp{border-radius:0}.tg-corner-rnd{border-radius:2rem}.tg-corner-rnd.bottom-only{border-top-left-radius:0;border-top-right-radius:0}.tg-corner-rnd.top-only{border-bottom-left-radius:0;border-bottom-right-radius:0}.tg-corner-v-rnd{border-radius:4rem}.tg-corner-v-rnd.bottom-only{border-top-left-radius:0;border-top-right-radius:0}.tg-corner-v-rnd.top-only{border-bottom-left-radius:0;border-bottom-right-radius:0}.tg-bg-primary{background:#8107c1}.tg-bg-secondary{background:#f0561a}.tg-bg-none{background:none}.tg-bg-light-1{background:#fff}.tg-bg-light-2{background:#efe6f9}.tg-bg-light-3{background:#ebf5ff}.tg-txt-light{color:#fff}.tg-txt-medium{color:#f0561a}.tg-txt-dark{color:#1e1a1b}.tg-padding-big{padding:5rem}.tg-row{display:flex}.tg-col{flex:1}.tg-pb-col{padding:2rem}.c-section.c-section-faq-bg{background-color:#fff}.c-section.default{padding:2rem 0;overflow:hidden}@media(min-width: 992px){.c-section.default{padding:3rem 0}}.c-section.small{padding:0;overflow:hidden}.c-section.large{padding:4rem 0;overflow:hidden}@media(min-width: 992px){.c-section.large{padding:4rem 0}}.c-section.post{padding-top:1.5rem}.c-section.hero{padding:3.5rem 0;background:no-repeat center center;background-size:cover;color:#1e1a1b}.c-section.hero.v03{position:relative}.c-section.hero.v03::before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f0561a;opacity:.5;z-index:0}.c-section.hero.v03 .container{position:relative;z-index:1}.c-section.hero.v04{position:relative;overflow:hidden}.c-section.hero.v04 .c-hero_canvas{position:relative;height:calc(100% + 5rem);aspect-ratio:1;margin-top:-6rem}.c-section.hero.v04 .c-hero_canvas>*{position:absolute}.c-section.hero.v04 .c-hero_canvas_img{border-radius:50%;-o-object-fit:cover;object-fit:cover;inset:0;width:100%;height:100%}.c-section.hero.v04 .c-hero_canvas_circle{border-radius:50%;aspect-ratio:1}.c-section.hero.v04 .c-hero_canvas_circle.small{inset:auto auto 0 23.93%;width:11.4%;background:#f0561a}.c-section.hero.v04 .c-hero_canvas_circle.medium{inset:5.36% auto auto 0;width:25.7%;background:#8107c1}.c-section.hero.v04 .c-hero_canvas_circle.big{width:59.6%;inset:auto -25.9% -25.9% auto;border:1px solid #1e1a1b}.c-section.hero.light{color:#fff;background-color:#1e1a1b}@media(min-width: 768px){.c-section.hero{padding:9rem 0}.c-section.hero p{font-size:1.125rem}}.c-section.error-hero{padding:20vw 0;margin-top:1rem;background:no-repeat left center;background-size:209% auto}.c-section.error-hero h1,.c-section.error-hero .h1,.c-section.error-hero .h1{font-size:4.5rem}.c-section.error-hero+.c-section.default{padding-top:0}@media(min-width: 568px){.c-section.error-hero{padding:10vw 0;margin-top:0;background-position:center;background-size:90% auto}.c-section.error-hero h1,.c-section.error-hero .h1,.c-section.error-hero .h1{font-size:5.5rem}}@media(min-width: 768px){.c-section.error-hero{padding:16vw 0}.c-section.error-hero h1,.c-section.error-hero .h1,.c-section.error-hero .h1{font-size:7.5rem}}@media(min-width: 992px){.c-section.error-hero{padding:8.5vw 0;background-size:72% auto}}@media(min-width: 1400px){.c-section.error-hero{background-size:60% auto}}.c-section.app{min-height:100vh;display:flex;align-items:stretch;justify-content:center}@media(min-width: 768px){.c-section.app{background:url("../img/app/app-bg.jpg") no-repeat center center;background-size:cover;padding:4rem 0;align-items:center}}.c-section .container.bg-secondary{background:#f0561a;border-radius:2rem;padding-top:1.5rem;padding-bottom:1.5rem}.c-section .container.bg-secondary .bg-1{background:#fff}.c-section .container.bg-primary{background:#8107c1;border-radius:2rem;padding-top:1.5rem;padding-bottom:1.5rem}.c-section .container.bg-primary .bg-1{background:#fff}.c-section .container.bg-card{background:#efe6f9;border-radius:2rem;padding-top:1.5rem;padding-bottom:1.5rem}.c-section .container.bg-card .bg-1{background:#fff}/*# sourceMappingURL=styles.min.css.map */ \ No newline at end of file +.c-post h1,.c-post .h1{font-size:1.875rem}.c-post h2,.c-post .h2{font-size:1.625rem}.c-post_body{margin:2.5rem 1.5rem 0}.c-post_body p{margin-top:1.625rem;margin-bottom:1.625rem}.c-post_quote{float:left;margin:.375rem 1.875rem 1.25rem 0;padding:1.75rem 1.5rem;background:#8107c1;color:#fff;font-size:1.25rem;text-align:center;width:190px;max-width:50%;font-weight:500}.c-post_quote_ico{font-size:3rem;line-height:.7}.c-post-thumbnail{font-size:1.125rem}.c-post-thumbnail_ico{width:7.5rem;height:7.5rem}.c-post-thumbnail.default .c-card{padding:2.25rem 2rem 2rem}.c-post-thumbnail.bg .c-card{display:flex;flex-direction:column;justify-content:space-between;align-items:center;min-height:28rem;background:no-repeat center center;background-size:cover;padding:2.25rem 2rem 2rem;position:relative;overflow:hidden}.c-post-thumbnail.bg .c-card:before{content:"";display:block;position:absolute;inset:0;background:#000;opacity:.3}.c-post-thumbnail.bg .c-card>*{z-index:1}.j-truncate_heading,.j-truncate_paragraph{max-height:5.25rem;text-overflow:ellipsis;overflow:hidden;display:-webkit-box !important;-webkit-line-clamp:3;-webkit-box-orient:vertical;white-space:normal}.btn .c-icon{font-size:1.25rem;margin-top:-3px}.btn-lg .c-icon,.btn-group-lg>.btn .c-icon{font-size:1.375rem;margin-right:.25rem;margin-top:0}.btn-social .c-icon{font-size:1.5rem;margin-top:0}.tg-btn-primary{background-color:#8107c1 !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.tg-btn-secondary{background-color:#f0561a !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-primary,.btn.tg-bg-primary:hover{background-color:#8107c1 !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-secondary,.btn.tg-bg-secondary:hover{background-color:#f0561a !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-none,.btn.tg-bg-none:hover{background-color:none !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-light-1,.btn.tg-bg-light-1:hover{background-color:#fff !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-light-2:hover{background-color:#efe6f9 !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-bg-light-3,.btn.tg-bg-light-3:hover{background-color:#ebf5ff !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.btn.tg-txt-light,.btn.tg-txt-light:hover{color:#fff !important}.btn.tg-txt-medium,.btn.tg-txt-medium:hover{color:#f0561a !important}.btn.tg-txt-dark,.btn.tg-txt-dark:hover{color:#1e1a1b !important}.c-card{display:flex;flex-direction:column;justify-content:space-between;color:#1e1a1b}.c-card.sm{padding:1rem 1.25rem}.c-card.md{padding:1rem}.c-card.lg{padding:1.5rem 1rem}.c-card.bg-1{background:#efe6f9}.c-card.bg-1 .c-card.bg-1{background:#fff}.c-card.bg-2{background:#f0561a}.c-card.bg-2 .c-card.bg-2{background:#fff}@media(min-width: 768px){.c-card.md{padding:1.5rem}.c-card.lg{padding:2.5rem}}.c-card.home{position:relative;padding:1.5rem 1rem}.c-card.home p{margin-top:1.2rem;height:auto;overflow:hidden}.c-card.home .c-card_img{flex-grow:1;flex-shrink:1;position:relative}.c-card.home .c-card_img img{position:absolute;inset:0;height:100%;width:100%;-o-object-fit:cover;object-fit:cover}@media(min-width: 992px){.c-card.home{padding:1.75rem 1.875rem;height:25rem}}.c-card-wrapper{padding:2rem 1rem;background-color:#efe6f9}.c-card-wrapper .c-card-home_content-01{background-color:#f3f4f5}@media(min-width: 768px){.c-card-wrapper{padding:2rem 1.5rem}}@media(min-width: 992px){.c-card-wrapper{padding:2rem 3rem}}.c-card-anchor{text-decoration:none}.c-card-anchor .c-card.bg-1{background-color:#efe6f9;transition:transform .3s,box-shadow .5s,background-color .3s ease-in-out}.c-card-anchor:hover .c-card.bg-1{background-color:#ebd8ff}.xpcookiebanner{width:100%;background-color:#fff;padding:16px 0;z-index:110;transform:translateY(100%);min-height:260px;color:#231f20;border-bottom:4px solid #7f09b7;display:none}.xpcookiebanner.is-active{display:flex;transform:translateY(0%)}.xpcookiebanner__inner{display:flex;align-items:flex-start;justify-content:space-between;flex-direction:column}@media(min-width: 768px){.xpcookiebanner__inner{flex-direction:row;align-items:center}}.xpcookiebanner__inner p,.xpcookiebanner__inner a{color:#000;margin:0;font-size:12px}@media(min-width: 568px){.xpcookiebanner__inner p,.xpcookiebanner__inner a{font-size:14px}}@media(min-width: 768px){.xpcookiebanner__inner p,.xpcookiebanner__inner a{font-size:16px}}.xpcookiebanner__header{width:100%;font-size:18px;font-weight:bold;margin:8px 16px 8px 0}@media(max-width: 567.98px){.xpcookiebanner__header{margin:16px 0 16px 0}}@media(max-width: 767.98px){.xpcookiebanner__header{margin:16px 32px 16px 0;font-size:30px}}.xpcookiebanner__header:after{content:""}.xpcookiebanner__ctas{display:flex;flex-direction:row;align-items:center;white-space:nowrap;margin-top:16px}@media(min-width: 568px){.xpcookiebanner__ctas{margin-top:0;margin-left:32px}}@media(min-width: 768px){.xpcookiebanner__ctas .btn{font-size:14px;padding-left:16px;padding-right:16px}}.xpcookiebanner__cta+.xpcookiebanner__cta{margin-top:0;margin-left:16px}.xpcookiebanner__message{font-size:0}.js-header--xpcookiebanner-is-active{margin-top:260px;top:260px}@media(max-width: 767.98px){.js-header--xpcookiebanner-is-active .nav .nav__inner{height:calc(100% - 260px);top:260px}}.cookie-preferences__levels{display:flex;flex-direction:column;min-height:400px}@media(max-width: 567.98px){.cookie-preferences__levels{min-height:350px}}.cookie-preferences__options{position:relative;margin:0;padding:0;list-style:none;min-height:300px;margin-top:-20.5px;margin-left:-16px}.cookie-preferences__options .cookie-preferences__option{color:#000;font-size:14px;cursor:pointer;padding-inline-start:11px;margin-bottom:10px}.cookie-preferences__options .cookie-preferences__option:nth-child(2){top:90px}.cookie-preferences__options .cookie-preferences__option:nth-child(3){top:180px}.cookie-preferences__options .cookie-preferences__option:nth-child(4){top:280px}.cookie-preferences__options .cookie-preferences__option:before{content:"";background:#908e8f;font-size:9px;border-radius:100%;padding-inline:5px;margin-inline-end:24px}.cookie-preferences__options .cookie-preferences__option--selected{font-weight:bold}.cookie-preferences__options .cookie-preferences__option-header{display:inline-block;font-weight:bold;margin-bottom:6px;font-size:15px}@media(min-width: 568px){.cookie-preferences__options .cookie-preferences__option-header{font-size:16px}}@media(min-width: 768px){.cookie-preferences__options .cookie-preferences__option-header{font-size:20px}}.cookie-preferences__options .cookie-preferences__option-description{display:block;padding-inline-start:32px;font-size:12px}@media(min-width: 568px){.cookie-preferences__options .cookie-preferences__option-description{font-size:14px}}@media(min-width: 768px){.cookie-preferences__options .cookie-preferences__option-description{font-size:16px}}.cookie-preferences__selector{position:relative;display:inline-block;width:300px;height:41px;transform:rotate(90deg);transform-origin:left;z-index:8}.cookie-preferences__range-fill{position:absolute;box-sizing:border-box;display:inline-block;left:5px;top:15.5px;border-radius:8px;border-top-right-radius:0;border-bottom-right-radius:0;width:calc(100% - 5px);height:10px;background:#f0561a}.cookie-preferences__range-slider{position:absolute;top:0;left:0px;-webkit-appearance:none;width:300px;height:41px;background:rgba(0,0,0,0);padding:0;box-sizing:border-box;cursor:pointer}.cookie-preferences__range-slider::-webkit-slider-thumb{-webkit-appearance:none}.cookie-preferences__range-slider::-ms-track{width:300px;cursor:pointer;background:rgba(0,0,0,0);border-color:rgba(0,0,0,0);color:rgba(0,0,0,0)}.cookie-preferences__range-slider:focus{outline:none}.cookie-preferences__range-slider::-moz-focus-outer{border:0}.cookie-preferences__range-slider::-webkit-slider-thumb{-webkit-appearance:none;border:3px solid #fff;height:30px;width:30px;border-radius:50%;background:#f0561a;cursor:pointer;margin-top:-10px}.cookie-preferences__range-slider::-webkit-slider-runnable-track{width:300px;height:10px;cursor:pointer;background:rgba(0,0,0,0)}.cookie-preferences__range-slider::-moz-range-thumb{border:3px solid #fff;height:30px;width:30px;border-radius:50%;background:#f0561a;cursor:pointer}.cookie-preferences__range-slider::-moz-range-track{box-sizing:border-box;width:300px;height:10px;cursor:pointer;background:rgba(0,0,0,0)}@media all and (-ms-high-contrast: none),(-ms-high-contrast: active){.cookie-preferences__range-fill{display:none}}.cookie-preferences__range-slider::-ms-thumb{box-shadow:0 0 0 3px #fff;height:30px;width:30px;border-radius:50%;background:#f0561a;cursor:pointer;margin-top:2px;box-sizing:border-box;border:0}.cookie-preferences__range-slider:focus::-ms-thumb{border:0}.cookie-preferences__range-slider::-ms-track{width:300px;height:10px;cursor:pointer;background:rgba(0,0,0,0);color:rgba(0,0,0,0);box-sizing:border-box}.cookie-preferences__range-slider::-ms-fill-lower{background:#f0561a}.cookie-preferences__range-slider::-ms-fill-upper{background:rgba(0,0,0,0)}.cookie-preferences__range-slider::-ms-tooltip{display:none}.cookie-preferences__message{margin-top:16px;margin-bottom:16px}@font-face{font-family:"GT Walsheim Pro";src:url("../font/GTWalsheimPro-Regular.eot");src:local("GT Walsheim Pro Regular"),local("GTWalsheimPro-Regular"),url("https://download.kentico.com/Assets/GT-Walsheim-Regular.woff") format("woff"),url("../font/GTWalsheimPro-Regular.eot?#iefix") format("embedded-opentype"),url("../font/GTWalsheimPro-Regular.woff2") format("woff2"),url("../font/GTWalsheimPro-Regular.ttf") format("truetype");font-weight:normal;font-style:normal}@font-face{font-family:"GT Walsheim Pro";src:url("../font/GTWalsheimPro-Bold.eot");src:local("GT Walsheim Pro Bold"),local("GTWalsheimPro-Bold"),url("https://download.kentico.com/Assets/GT-Walsheim-Bold.woff") format("woff"),url("../font/GTWalsheimPro-Bold.eot?#iefix") format("embedded-opentype"),url("../font/GTWalsheimPro-Bold.woff2") format("woff2"),url("../font/GTWalsheimPro-Bold.ttf") format("truetype");font-weight:bold;font-style:normal}@font-face{font-family:"GT Walsheim Pro";src:url("../font/GTWalsheimPro-Medium.eot");src:local("GT Walsheim Pro Medium"),local("GTWalsheimPro-Medium"),url("https://download.kentico.com/Assets/GT-Walsheim-Medium.woff") format("woff"),url("../font/GTWalsheimPro-Medium.eot?#iefix") format("embedded-opentype"),url("../font/GTWalsheimPro-Medium.woff2") format("woff2"),url("../font/GTWalsheimPro-Medium.ttf") format("truetype");font-weight:500;font-style:normal}@font-face{font-family:"Vollkorn";src:url("../font/Vollkorn-Regular.eot");src:local("Vollkorn Regular"),local("Vollkorn-Regular"),url("../font/Vollkorn-Regular.eot?#iefix") format("embedded-opentype"),url("../font/Vollkorn-Regular.woff") format("woff"),url("../font/Vollkorn-Regular.ttf") format("truetype");font-weight:normal;font-style:normal}@font-face{font-family:"Vollkorn";src:url("../font/Vollkorn-Bold.eot");src:local("Vollkorn Bold"),local("Vollkorn-Bold"),url("../font/Vollkorn-Bold.eot?#iefix") format("embedded-opentype"),url("../font/Vollkorn-Bold.woff") format("woff"),url("../font/Vollkorn-Bold.ttf") format("truetype");font-weight:bold;font-style:normal}@font-face{font-family:"Vollkorn";src:url("../font/Vollkorn-Medium.eot");src:local("Vollkorn Medium"),local("Vollkorn-Medium"),url("../font/Vollkorn-Medium.eot?#iefix") format("embedded-opentype"),url("../font/Vollkorn-Medium.woff") format("woff"),url("../font/Vollkorn-Medium.ttf") format("truetype");font-weight:500;font-style:normal}.c-footer{background:#ebf5ff;padding:2.5rem 1rem 1.25rem;text-align:center;position:relative;overflow:hidden}.c-footer .navbar-brand{display:block}.c-footer .nav{justify-content:end}.c-footer .nav-link{font-size:1rem;font-weight:400;padding:0}.c-footer .nav-item{display:flex;align-items:center;padding:0 0 0 1rem}.c-footer .c-note{font-size:.75rem}.c-footer_circle{position:absolute;top:-20%;left:93%;padding:15%;border:1px solid #f0561a;background-color:#f0561a}@media(min-width: 568px){.c-footer{padding:2rem 1rem 2.25rem}.c-footer .navbar-brand{margin-top:.625rem;text-align:left}.c-footer .nav{justify-content:flex-end;margin-top:0}.c-footer .c-note{text-align:right}}@media(min-width: 992px){.c-footer .navbar-brand{margin-top:.5rem}}.c-footer .c-divider{border-bottom:2px solid #cfc9ca;padding-bottom:2rem}@media(max-width: 767.98px){.c-footer-grid{display:grid;grid-template-columns:repeat(2, 1fr)}.c-footer-grid .grid-item:nth-of-type(1){order:1}.c-footer-grid .grid-item:nth-of-type(2){order:3}.c-footer-grid .grid-item:nth-of-type(3){order:2}.c-footer-grid .grid-item:nth-of-type(4){order:4}}.c-list-footer{text-align:start;padding:0}.c-list-footer_item{list-style:none;padding:.25rem 0}.c-list-footer_item a{text-decoration:none;color:#231f20;font-weight:500}.c-list-footer_item h2,.c-list-footer_item .h2{font-size:.75rem;margin-bottom:0;padding-bottom:.2rem}.form form{display:grid}.form form input[type=submit]{background-color:#f0561a !important;color:#fff !important;border:none !important;border-top-left-radius:1.75rem !important;border-bottom-left-radius:1.75rem !important;border-top-right-radius:1.75rem !important;border-bottom-right-radius:1.75rem !important;transition:.15s opacity,.15s transform,.15s background-color !important;white-space:nowrap !important;font-size:.875rem !important;line-height:1rem !important;padding:.9375rem 2rem !important;text-transform:uppercase !important}.form form input[type=submit]:hover{background-color:#f0561a;border-color:#f0561a;color:#fff;border:none}.form form .form-field{margin:1rem 0;position:relative}.form form .form-field .control-label{margin-bottom:.375rem;font-size:.875rem;font-weight:700}.form form .form-field .field-validation-error{position:absolute;bottom:-17px;left:20px;color:#b72929;font-size:.75rem;font-weight:700}.form .formwidget-submit-text{text-align:center;margin:2rem 0;font-weight:700}.c-header{background:#fff;transition:.2s box-shadow;border-bottom:1px solid rgba(206,212,218,.5)}.c-header.scrolled{box-shadow:0 8px 32px rgba(16,33,60,.24),0 0 8px rgba(0,0,0,.03);border-bottom:none}.c-header .navbar-toggler{margin-bottom:.75rem;margin-left:1rem;margin-right:-1rem}.c-header #sign-in-tablet{display:none;margin:0 0 .75rem auto}@media(min-width: 400px)and (max-width: 767.98px){.c-header #sign-in-tablet{display:block}.c-header .nav-item.with-btn{display:none}}@media(max-width: 991.98px){.c-header .c-main-navbar{padding-top:1rem;padding-bottom:.875rem}}@media(max-width: 767.98px){.c-header:after{content:"";display:block;position:absolute;top:4.5rem;left:0;right:0;height:0;border-top:1px solid rgba(144,142,143,.5);opacity:0;transition:.15s opacity}.c-header.mobile-nav-open{box-shadow:0 8px 32px rgba(16,33,60,.24),0 0 8px rgba(0,0,0,.03)}.c-header.mobile-nav-open:after{opacity:1}.c-header.mobile-nav-open .c-subnav,.c-header.mobile-nav-open .c-subnav-alt{margin-top:-4rem}.c-header .c-main-navbar{padding-bottom:0;padding-top:.625rem}.c-header .navbar-brand{margin-bottom:1rem;margin-top:.25rem}}@media(min-width: 768px){.c-header .navbar-brand.c-circle-logo{border-radius:50%;height:10rem;width:10rem;border:1px solid rgba(206,212,218,.5);position:absolute;top:1.625rem;background:#fff}.c-header .navbar-brand.c-circle-logo img{transform:rotate(90deg);position:absolute;inset:10%;margin:auto;max-width:80%;max-height:80%}}@media(min-width: 992px){.c-header .c-main-navbar{padding-bottom:1.375rem}}.c-header-alert{background:#f05a22;color:#fff;position:relative;font-size:.875rem}.c-header-alert_inner{padding:.5rem 1.25rem .5rem .25rem}.c-header-alert .btn-close{position:absolute;top:.5rem;right:.5rem}.c-header-alert p a{color:#fff}.c-header-alert p a:hover{text-decoration:none}@media(min-width: 568px){.c-header-alert_inner{padding:.5rem 1.5rem .5rem 1.25rem}}@media(min-width: 768px){.c-header-alert_inner{padding:.75rem 1.5rem .75rem 1.25rem}.c-header-alert .btn-close{top:.75rem;right:.75rem}}@media(min-width: 992px){.c-header-alert{text-align:center}}@media(min-width: 1400px){.c-header-alert{font-size:1.125rem}.c-header-alert .btn-close{right:3.625rem}}.dropdown{top:25%}.c-why_heading{color:#1e1a1b}.c-products-grid{margin-left:-1rem;margin-right:-1rem;position:relative;z-index:1}.c-products-grid:before,.c-products-grid:after{content:"";display:block;position:absolute;background:#efe6f9;z-index:1}.c-products-grid:before{inset:0 auto 2rem 0;width:36vw}.c-products-grid_inner{position:relative;margin-bottom:1rem;padding-bottom:3rem;overflow:auto;scrollbar-color:#8107c1 #fff}.c-products-grid_inner::-webkit-scrollbar{width:6px;height:6px}.c-products-grid_inner::-webkit-scrollbar-track{margin:0 50px;background:#fff}.c-products-grid_inner::-webkit-scrollbar-thumb{background:#8107c1}.c-products-grid_scrollable{width:-moz-max-content;width:max-content}.c-products-grid_bg{position:absolute;top:0;bottom:3rem;background:#fff;border-radius:2rem;width:46vw;margin-left:-1vw;z-index:-1}.c-products-grid_bg.highlight{box-shadow:0 0 2vw 0 #f0561a}.c-products-grid_row{display:flex;justify-content:flex-start;padding:0 0 0 2vw;background:rgba(0,0,0,0);transition:.2s background-color ease}.c-products-grid_row.no-hover .c-products-grid_col{position:static}.c-products-grid_row.no-hover .c-products-grid_col:before{content:"";display:none}.c-products-grid_row.no-hover .c-products-grid_col.gap,.c-products-grid_row.no-hover .c-products-grid_col.th{position:sticky}.c-products-grid_row:first-child .c-products-grid_col{align-items:flex-end;padding:1.5rem 0 1rem}.c-products-grid_row:last-child .c-products-grid_col{border-bottom:none}.c-products-grid_row.shortDescription .c-products-grid_col{border-bottom:none}.c-products-grid_col{position:relative;display:flex;flex-grow:0;flex-shrink:0;align-items:center;justify-content:center;width:42vw;padding:1.25rem 0;min-height:3.5rem;border-bottom:1px solid #f0f0f2;text-align:center;margin:0 4vw;font-size:1.125rem;color:#1e1a1b}.c-products-grid_col:before{content:"";display:block;position:absolute;inset:0;background:rgba(0,0,0,0);transition:.2s background-color ease;z-index:-1}.c-products-grid_col.th{width:34vw;text-align:left;justify-content:flex-start;border-bottom:1px solid #f0561a;margin:0;padding:1.25rem 0;font-size:1rem;position:sticky;left:2vw;z-index:1;color:inherit}.c-products-grid_col.th:before{inset:0}.c-products-grid_col.gap{width:1vw;border-bottom:none;margin:0;padding:0;position:sticky;right:0;z-index:1;background:#efe6f9}.c-products-grid_col.gap:before{content:none;display:none}.c-products-grid_col h3,.c-products-grid_col .h3,.c-products-grid_col h4,.c-products-grid_col .h4{margin-bottom:0}.c-products-grid_col:nth-last-child(2){margin-right:22px}.c-products-grid_del-price{color:#8107c1}.c-products-grid_check{color:#f0561a}.c-products-grid .accordion-button{--bs-accordion-btn-padding-x: 0;--bs-accordion-btn-padding-y: .5rem}@media(min-width: 568px){.c-products-grid{margin-left:-1rem;margin-right:-1rem}.c-products-grid:before{width:204px}.c-products-grid_bg{width:240px;margin-left:-15px}.c-products-grid_bg.highlight{box-shadow:0 0 20px 0 #f0561a}.c-products-grid_row{padding:0 0 0 24px}.c-products-grid_col{width:210px;margin:0 30px;min-height:4rem}.c-products-grid_col.th{width:180px;margin:0 12px 0 0;left:24px}.c-products-grid_col.gap{width:30px;margin:0 0 0 -2px}}@media(min-width: 768px){.c-products-grid{margin-left:-2.5rem;margin-right:-2.5rem}.c-products-grid:before{width:276px}.c-products-grid_bg{width:300px;margin-left:-15px}.c-products-grid_bg.highlight{box-shadow:0 0 30px 0 #f0561a}.c-products-grid_row:hover .c-products-grid_col:before{background:rgba(0,0,0,.05)}.c-products-grid_col{width:270px;margin:0 30px;min-height:4rem}.c-products-grid_col.th{width:236px;margin:0 30px 0 0;left:36px;padding:1.25rem 1rem}.c-products-grid_col.gap{width:30px;margin:0 0 0 -2px}.c-products-grid_col:before{inset:0 -15px}}@media(min-width: 992px){.c-products-grid_bg{width:250px}.c-products-grid_col{width:220px;margin:0 30px;min-height:4rem}}@media(min-width: 1200px){.c-products-grid:before{width:282px}.c-products-grid_bg{width:224px;margin-left:-20px}.c-products-grid_bg.highlight{box-shadow:0 0 30px 0 #f0561a}.c-products-grid_row{padding:0 0 0 58px}.c-products-grid_col{width:184px;min-height:5rem}.c-products-grid_col.th{width:224px;left:58px;margin:0 15px 0 0}.c-products-grid_col:nth-last-child(2){margin-right:22px}.c-products-grid_col:before{inset:0 -20px}}.c-product-img{max-width:35rem;max-height:20rem}.c-pricelist{padding:1.5rem 1rem}.c-pricelist_text{margin-top:1.5rem;display:flex;flex-direction:column;justify-content:center}.c-pricelist_price{color:#f0561a}.c-pricelist_heading{color:#1e1a1b}.c-pricelist .c-table{padding:1rem;border:solid 1px #a0a0a2;margin:0 4rem}.c-pricelist .c-table_row{border-top:1px solid #f0f0f2;align-items:center}.c-pricelist .c-table_row:last-child{border-bottom:1px solid #f0f0f2}.c-pricelist .c-table_cell{padding:.375rem}@media(max-width: 567.98px){.c-pricelist .c-table_cell:first-child{padding-left:0}.c-pricelist .c-table_cell:last-child{padding-right:0}}.c-pricelist.compact{padding:0;background:0}.c-pricelist.compact .c-table{padding:.5rem .75rem}.c-pricelist.compact .c-table_row{flex-direction:column;align-items:flex-start}.c-pricelist.compact .c-table_row:first-child{border-top:0}.c-pricelist.compact .c-table_row:last-child{border-bottom:0}.c-pricelist.compact .c-table_cell{padding:0 .75rem}.c-pricelist.compact .c-table_cell.light{opacity:.7}.c-pricelist.compact .c-table_cell:first-child{padding-top:.5rem}.c-pricelist.compact .c-table_cell:last-child{padding-bottom:.5rem}.c-table_row{display:flex;justify-content:space-between}@media(min-width: 568px){.c-pricelist{margin-top:0}.c-pricelist_text{margin-top:0}.c-pricelist .c-table{font-size:1rem;padding:1.5rem 1rem}}@media(min-width: 768px){.c-pricelist{padding:2.5rem}.c-pricelist .c-table{padding:1.75rem}.c-pricelist .c-table_cell{padding:.625rem .75rem}}@media(min-width: 1200px){.c-pricelist{padding:4rem}.c-pricelist .c-table{padding:2rem}}.tg-product img.tg-product_img{-o-object-fit:cover;object-fit:cover}.tg-product .tg-product_benefits{display:flex}.tg-product .align-left{text-align:left}.tg-product .align-left .tg-product_benefits{flex-direction:row}.tg-product .align-center{text-align:center}.tg-product .align-center .tg-product_benefits{text-align:left;flex-direction:row}.tg-product .align-right{text-align:right}.tg-product .align-right .tg-product_benefits{flex-direction:row-reverse}.tg-product a:link,.tg-product a:visited,.tg-product a:hover,.tg-product a:active{text-decoration:none;color:inherit}.tg-product.tg-layout-full-width img.tg-product_img{max-height:10rem;width:100%}.tg-product.tg-layout-ascending,.tg-product.tg-layout-descending{position:relative;padding:1rem;background-color:rgba(0,0,0,0) !important}.tg-product.tg-layout-ascending .tg-product_main,.tg-product.tg-layout-descending .tg-product_main{width:65%;margin-top:35% !important;position:relative;z-index:10}.tg-product.tg-layout-ascending img.tg-product_img,.tg-product.tg-layout-descending img.tg-product_img{position:absolute;width:65%;max-height:100%;-o-object-fit:cover;object-fit:cover;top:0}.tg-product.tg-layout-ascending img.tg-product_img{right:0}.tg-product.tg-layout-ascending .tg-product_main{margin-left:0 !important;margin-right:auto !important}.tg-product.tg-layout-descending img.tg-product_img{left:0}.tg-product.tg-layout-descending .tg-product_main{margin-left:auto !important;margin-right:0 !important}.tg-product.tg-layout-image-left,.tg-product.tg-layout-image-right{background-color:rgba(0,0,0,0) !important}.tg-product.tg-layout-image-left .tg-product_main,.tg-product.tg-layout-image-right .tg-product_main{width:100%;margin:0 !important}.tg-product.tg-layout-image-left img.tg-product_img,.tg-product.tg-layout-image-right img.tg-product_img{max-width:80%;overflow:hidden}.tg-product.tg-layout-image-left .tg-row{flex-direction:row-reverse}.t-default{background:#fff;color:#1e1a1b;--bs-body-font-family: "GT Walsheim Pro", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif}.content-wrapper{min-height:calc(100vh - 12.5rem)}@media(min-width: 1200px){.content-wrapper{min-height:calc(100vh - 14rem)}}.c-circle{position:absolute;border-radius:50%}.u-border-01{border:none;border-radius:2rem}.u-border-02{border:none;border-radius:2rem}.c-img-placeholder.type01{width:5rem;height:4rem}.c-img-placeholder.type02{width:3rem;height:2.5rem}.c-icon{display:inline-block;height:1em;width:1em;vertical-align:top}.c-icon-box{display:grid;grid-template-columns:1.5rem 1fr;gap:.75rem}.c-icon-box_icon{color:#8107c1}.c-icon-box_icon .c-icon{width:1.5rem;height:1.5rem}.c-link.basic{color:inherit;text-decoration:underline}.c-link.basic:hover,.c-link.basic:focus{color:inherit;text-decoration:none}.c-link.silent{color:inherit;text-decoration:none}.c-link.silent:hover,.c-link.silent:focus{color:inherit;text-decoration:underline}.c-link.primary-upper{color:#8107c1;font-weight:500;text-transform:uppercase;text-decoration:none;transition:.15s color ease}.c-link.primary-upper .c-icon{width:.875rem;height:.875rem;vertical-align:baseline}.c-link.primary-upper:hover,.c-link.primary-upper:focus{color:#8107c1}.c-link.primary-upper:active{color:#8107c1}.c-date{font-size:.875rem;margin:.6rem 0;color:#f0561a}.tg-corner-shrp{border-radius:0}.tg-corner-rnd{border-radius:2rem}.tg-corner-rnd.bottom-only{border-top-left-radius:0;border-top-right-radius:0}.tg-corner-rnd.top-only{border-bottom-left-radius:0;border-bottom-right-radius:0}.tg-corner-v-rnd{border-radius:4rem}.tg-corner-v-rnd.bottom-only{border-top-left-radius:0;border-top-right-radius:0}.tg-corner-v-rnd.top-only{border-bottom-left-radius:0;border-bottom-right-radius:0}.tg-bg-primary{background:#8107c1}.tg-bg-secondary{background:#f0561a}.tg-bg-none{background:none}.tg-bg-light-1{background:#fff}.tg-bg-light-2{background:#efe6f9}.tg-bg-light-3{background:#ebf5ff}.tg-txt-light{color:#fff}.tg-txt-medium{color:#f0561a}.tg-txt-dark{color:#1e1a1b}.tg-padding-big{padding:5rem}.tg-row{display:flex}.tg-col{flex:1}.tg-pb-col{padding:2rem}.c-section.c-section-faq-bg{background-color:#fff}.c-section.default{padding:2rem 0;overflow:hidden}@media(min-width: 992px){.c-section.default{padding:3rem 0}}.c-section.small{padding:0;overflow:hidden}.c-section.large{padding:4rem 0;overflow:hidden}@media(min-width: 992px){.c-section.large{padding:4rem 0}}.c-section.post{padding-top:1.5rem}.c-section.hero{padding:3.5rem 0;background:no-repeat center center;background-size:cover;color:#1e1a1b}.c-section.hero.v03{position:relative}.c-section.hero.v03::before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f0561a;opacity:.5;z-index:0}.c-section.hero.v03 .container{position:relative;z-index:1}.c-section.hero.v04{position:relative;overflow:hidden}.c-section.hero.v04 .c-hero_canvas{position:relative;height:calc(100% + 5rem);aspect-ratio:1;margin-top:-6rem}.c-section.hero.v04 .c-hero_canvas>*{position:absolute}.c-section.hero.v04 .c-hero_canvas_img{border-radius:50%;-o-object-fit:cover;object-fit:cover;inset:0;width:100%;height:100%}.c-section.hero.v04 .c-hero_canvas_circle{border-radius:50%;aspect-ratio:1}.c-section.hero.v04 .c-hero_canvas_circle.small{inset:auto auto 0 23.93%;width:11.4%;background:#f0561a}.c-section.hero.v04 .c-hero_canvas_circle.medium{inset:5.36% auto auto 0;width:25.7%;background:#8107c1}.c-section.hero.v04 .c-hero_canvas_circle.big{width:59.6%;inset:auto -25.9% -25.9% auto;border:1px solid #1e1a1b}.c-section.hero.light{color:#fff;background-color:#1e1a1b}@media(min-width: 768px){.c-section.hero{padding:9rem 0}.c-section.hero p{font-size:1.125rem}}.c-section.error-hero{padding:20vw 0;margin-top:1rem;background:no-repeat left center;background-size:209% auto}.c-section.error-hero h1,.c-section.error-hero .h1,.c-section.error-hero .h1{font-size:4.5rem}.c-section.error-hero+.c-section.default{padding-top:0}@media(min-width: 568px){.c-section.error-hero{padding:10vw 0;margin-top:0;background-position:center;background-size:90% auto}.c-section.error-hero h1,.c-section.error-hero .h1,.c-section.error-hero .h1{font-size:5.5rem}}@media(min-width: 768px){.c-section.error-hero{padding:16vw 0}.c-section.error-hero h1,.c-section.error-hero .h1,.c-section.error-hero .h1{font-size:7.5rem}}@media(min-width: 992px){.c-section.error-hero{padding:8.5vw 0;background-size:72% auto}}@media(min-width: 1400px){.c-section.error-hero{background-size:60% auto}}.c-section.app{min-height:100vh;display:flex;align-items:stretch;justify-content:center}@media(min-width: 768px){.c-section.app{background:url("../img/app/app-bg.jpg") no-repeat center center;background-size:cover;padding:4rem 0;align-items:center}}.c-section .container.bg-secondary{background:#f0561a;border-radius:2rem;padding-top:1.5rem;padding-bottom:1.5rem}.c-section .container.bg-secondary .bg-1{background:#fff}.c-section .container.bg-primary{background:#8107c1;border-radius:2rem;padding-top:1.5rem;padding-bottom:1.5rem}.c-section .container.bg-primary .bg-1{background:#fff}.c-section .container.bg-card{background:#efe6f9;border-radius:2rem;padding-top:1.5rem;padding-bottom:1.5rem}.c-section .container.bg-card .bg-1{background:#fff}/*# sourceMappingURL=styles.min.css.map */ \ No newline at end of file diff --git a/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css.map b/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css.map index cb55857d..1858d28c 100644 --- a/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css.map +++ b/src/TrainingGuides.Web/wwwroot/assets/css/styles.min.css.map @@ -1 +1 @@ -{"version":3,"sources":["../../../scss/_article.scss","../../../scss/_variables.scss","../../../scss/_button.scss","../../../scss/_mixins.scss","../../../scss/_card.scss","../../../scss/_data-protection.scss","../../../scss/_font.scss","../../../scss/_footer.scss","../../../scss/_form.scss","../../../scss/_header.scss","../../../scss/_product.scss","../../../scss/_shared.scss","../../../scss/_section.scss"],"names":[],"mappings":"AAEA,uBAEI,kBAAA,CAGJ,uBAEI,kBAAA,CAGJ,aACI,sBAAA,CAGJ,eACI,mBAAA,CACA,sBAAA,CAGJ,cACI,UAAA,CACA,iCAAA,CACA,sBAAA,CACA,kB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A,CAIR,yBACI,sBACI,cAAA,CAGJ,6EAGI,gBAAA,CAAA,CAIR,yBACI,sBACI,eAAA,CACA,wBAAA,CAAA,CAIR,0BACI,sBACI,wBAAA,CAAA,CAIR,eACI,gBAAA,CACA,YAAA,CACA,mBAAA,CACA,sBAAA,CAGJ,yBACI,eACI,+DAAA,CACA,qBAAA,CACA,cAAA,CACA,kBAAA,CAAA,CAIR,mCACI,kBX1MU,CW2MV,kBXhMwB,CWiMxB,kBAAA,CACA,qBAAA,CAGJ,yCACI,eAAA,CAGJ,iCACI,kBXtNQ,CWuNR,kBX3MwB,CW4MxB,kBAAA,CACA,qBAAA,CAGJ,uCACI,eAAA,CAGJ,8BACI,kBX7NgB,CW8NhB,kBXtNwB,CWuNxB,kBAAA,CACA,qBAAA,CAGJ,oCACI,eAAA","file":"styles.min.css"} \ No newline at end of file +{"version":3,"sources":["../../../scss/_article.scss","../../../scss/_variables.scss","../../../scss/_button.scss","../../../scss/_mixins.scss","../../../scss/_card.scss","../../../scss/_data-protection.scss","../../../scss/_font.scss","../../../scss/_footer.scss","../../../scss/_form.scss","../../../scss/_header.scss","../../../scss/_product.scss","../../../scss/_shared.scss","../../../scss/_section.scss"],"names":[],"mappings":"AAEA,uBAEI,kBAAA,CAGJ,uBAEI,kBAAA,CAGJ,aACI,sBAAA,CAGJ,eACI,mBAAA,CACA,sBAAA,CAGJ,cACI,UAAA,CACA,iCAAA,CACA,sBAAA,CACA,kBCzBY,CD0BZ,UCvBU,CDwBV,iBAAA,CACA,iBAAA,CACA,WAAA,CACA,aAAA,CACA,eAAA,CAGJ,kBACI,cAAA,CACA,cAAA,CAGJ,kBACI,kBAAA,CAGJ,sBACI,YAAA,CACA,aAAA,CAGJ,kCACI,yBAAA,CAGJ,6BACI,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,kBAAA,CACA,gBAAA,CACA,kCAAA,CACA,qBAAA,CACA,yBAAA,CACA,iBAAA,CACA,eAAA,CAGJ,oCACI,UAAA,CACA,aA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,yCACI,eAAA,CAGJ,iCACI,kBXtNQ,CWuNR,kBX3MwB,CW4MxB,kBAAA,CACA,qBAAA,CAGJ,uCACI,eAAA,CAGJ,8BACI,kBX7NgB,CW8NhB,kBXtNwB,CWuNxB,kBAAA,CACA,qBAAA,CAGJ,oCACI,eAAA","file":"styles.min.css"} \ No newline at end of file From a2f8a86235d0296cea6c0df2582206ac98b05cdc Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 14 Nov 2024 15:05:00 -0500 Subject: [PATCH 28/60] GH-89 :: move mapper to services, add service to map members to contacts outside of default events, map during sign-in, add more handling for cookie/contact data --- .../Services/CookieConsentService.cs | 2 +- .../TrainingGuidesMemberToContactMapper.cs | 79 ------------ .../Services/IMemberContactService.cs | 47 +++++++ .../Services/MemberContactService.cs | 116 ++++++++++++++++++ .../Membership/Services/MembershipService.cs | 38 +++--- .../TrainingGuidesMemberToContactMapper.cs | 35 ++++++ .../ServiceCollectionExtensions.cs | 1 + 7 files changed, 222 insertions(+), 96 deletions(-) delete mode 100644 src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Services/TrainingGuidesMemberToContactMapper.cs diff --git a/src/TrainingGuides.Web/Features/DataProtection/Services/CookieConsentService.cs b/src/TrainingGuides.Web/Features/DataProtection/Services/CookieConsentService.cs index 095e8b1a..d2c758c9 100644 --- a/src/TrainingGuides.Web/Features/DataProtection/Services/CookieConsentService.cs +++ b/src/TrainingGuides.Web/Features/DataProtection/Services/CookieConsentService.cs @@ -276,7 +276,7 @@ private void SetCookieLevelIfChanged(int newLevel) public bool CurrentContactCanBeTracked() { bool isAllOrHigher = false; - string cookieLevelString = cookieAccessor.Get("CMSCookieLevel"); + string cookieLevelString = cookieAccessor.Get(CookieNames.CMS_COOKIE_LEVEL); if (int.TryParse(cookieLevelString, out int cookieLevel)) isAllOrHigher = cookieLevel >= 1000; diff --git a/src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs b/src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs deleted file mode 100644 index dc99eb09..00000000 --- a/src/TrainingGuides.Web/Features/Membership/ContactMapping/TrainingGuidesMemberToContactMapper.cs +++ /dev/null @@ -1,79 +0,0 @@ -using CMS; -using CMS.ContactManagement; -using CMS.DataEngine; -using CMS.Membership; - -using Kentico.OnlineMarketing.Web.Mvc; - -using TrainingGuides.Web.Features.Membership.ContactMapping; - -[assembly: RegisterImplementation(typeof(IMemberToContactMapper), typeof(TrainingGuidesMemberToContactMapper))] - -namespace TrainingGuides.Web.Features.Membership.ContactMapping; -public class TrainingGuidesMemberToContactMapper : IMemberToContactMapper -{ - private readonly IInfoProvider contactInfoProvider; - - public TrainingGuidesMemberToContactMapper(IInfoProvider contactInfoProvider) - { - this.contactInfoProvider = contactInfoProvider; - } - - /// - /// Maps a member to a contact and updates the contact if it has changed - /// - /// The member whose data should be transferred - /// The contact to transfer the data to - public void Map(MemberInfo member, ContactInfo contact) - { - if (member is null || contact is null) - return; - - contact = TransferMemberFieldsToContact(member, contact); - - UpdateContactIfChanged(contact); - } - - /// - /// Transfers values from member to contact - /// - /// The member whose data should be transferred - /// The contact to transfer the data to - /// The updated ContactInfo object, but DOES NOT save the contact data - public ContactInfo TransferMemberFieldsToContact(MemberInfo member, ContactInfo contact) - { - var guidesMember = member.AsGuidesMember(); - - if (!string.IsNullOrWhiteSpace(guidesMember.GivenName)) - { - contact.ContactFirstName = guidesMember.GivenName; - } - if (!string.IsNullOrWhiteSpace(guidesMember.FamilyName)) - { - _ = contact.ContactLastName = guidesMember.FamilyName; - } - if (!string.IsNullOrWhiteSpace(guidesMember.FavoriteCoffee)) - { - _ = contact.SetValue("TrainingGuidesContactFavoriteCoffee", guidesMember.FavoriteCoffee); - } - - // Sets the Member ID of the current contact - contact.SetValue("TrainingGuidesContactMemberId", guidesMember.Id); - - // For data security, do not overwrite contact email address if it is already set - if (string.IsNullOrWhiteSpace(contact.ContactEmail) && !string.IsNullOrWhiteSpace(guidesMember.Email)) - { - contact.ContactEmail = guidesMember.Email; - } - - return contact; - } - - private void UpdateContactIfChanged(ContactInfo contact) - { - if (contact.HasChanged) - { - contactInfoProvider.Set(contact); - } - } -} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs new file mode 100644 index 00000000..09145871 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs @@ -0,0 +1,47 @@ +using CMS.ContactManagement; +using CMS.Membership; + +namespace TrainingGuides.Web.Features.Membership.Services; + +public interface IMemberContactService +{ + /// + /// Transfers values from MemberInfo to ContactInfo + /// + /// The member whose data should be transferred + /// The contact to transfer the data to + /// The updated ContactInfo object, but DOES NOT save the contact data + ContactInfo TransferMemberFieldsToContact(MemberInfo member, ContactInfo contact); + + /// + /// Transfers values from GuidesMember to ContactInfo + /// + /// The member whose data should be transferred + /// The contact to transfer the data to + /// The updated ContactInfo object, but DOES NOT save the contact data + ContactInfo TransferMemberFieldsToContact(GuidesMember guidesMember, ContactInfo contact); + + /// + /// Saves the contact data if it has changed + /// + /// The contact to save + void UpdateContactIfChanged(ContactInfo contact); + + /// + /// Gets the oldest contact associated with the provided member whose email matches + /// + /// The GuidesMember to find an associated contact + /// The oldest contact associated with the provided member whose email matches + ContactInfo? GetOldestMemberContactWithMatchingEmail(GuidesMember member); + + /// + /// Sets the CurrentContact to the oldest one with a matching email that is associated with the given member + /// + /// The member to find an associated contact for + void SetCurrentContactForMember(GuidesMember member); + + /// + /// Removes contact related cookies + /// + void RemoveContactCookies(); +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs new file mode 100644 index 00000000..b173ae94 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs @@ -0,0 +1,116 @@ +using CMS.ContactManagement; +using CMS.DataEngine; +using CMS.Membership; +using Kentico.Web.Mvc; +using TrainingGuides.Web.Features.DataProtection.Shared; + +namespace TrainingGuides.Web.Features.Membership.Services; + +public class MemberContactService : IMemberContactService +{ + private readonly IInfoProvider contactInfoProvider; + private readonly ICookieAccessor cookieAccessor; + private readonly ICurrentContactProvider currentContactProvider; + + public MemberContactService(IInfoProvider contactInfoProvider, + ICookieAccessor cookieAccessor, + ICurrentContactProvider currentContactProvider) + { + this.contactInfoProvider = contactInfoProvider; + this.cookieAccessor = cookieAccessor; + this.currentContactProvider = currentContactProvider; + } + + /// + public ContactInfo TransferMemberFieldsToContact(MemberInfo member, ContactInfo contact) + { + var guidesMember = member.AsGuidesMember(); + + return TransferMemberFieldsToContact(guidesMember, contact); + } + + /// + public ContactInfo TransferMemberFieldsToContact(GuidesMember guidesMember, ContactInfo contact) + { + if (!string.IsNullOrWhiteSpace(guidesMember.GivenName)) + { + contact.ContactFirstName = guidesMember.GivenName; + } + if (!string.IsNullOrWhiteSpace(guidesMember.FamilyName)) + { + _ = contact.ContactLastName = guidesMember.FamilyName; + } + if (!string.IsNullOrWhiteSpace(guidesMember.FavoriteCoffee)) + { + _ = contact.SetValue("TrainingGuidesContactFavoriteCoffee", guidesMember.FavoriteCoffee); + } + + // Sets the Member ID of the current contact + contact.SetValue("TrainingGuidesContactMemberId", guidesMember.Id); + + // For data security, do not overwrite contact email address if it is already set + if (string.IsNullOrWhiteSpace(contact.ContactEmail) && !string.IsNullOrWhiteSpace(guidesMember.Email)) + { + contact.ContactEmail = guidesMember.Email; + } + + return contact; + } + + /// + public void UpdateContactIfChanged(ContactInfo contact) + { + if (contact.HasChanged) + { + contactInfoProvider.Set(contact); + } + } + + /// + public ContactInfo? GetOldestMemberContactWithMatchingEmail(GuidesMember member) + { + var contact = contactInfoProvider.Get() + .WhereEquals("TrainingGuidesContactMemberId", member.Id) + .WhereEquals(nameof(ContactInfo.ContactEmail), member.Email) + .OrderBy(nameof(ContactInfo.ContactCreated)) + .TopN(1) + .FirstOrDefault(); + + return contact; + } + + /// + public void SetCurrentContactForMember(GuidesMember member) + { + var contact = GetOldestMemberContactWithMatchingEmail(member); + if (contact is not null) + { + EnsureContactCookieLevel(); + currentContactProvider.SetCurrentContact(contact); + } + } + + /// + public void RemoveContactCookies() + { + cookieAccessor.Remove(CookieNames.CURRENT_CONTACT); + cookieAccessor.Remove(CookieNames.CMS_COOKIE_LEVEL); + cookieAccessor.Remove(CookieNames.COOKIE_ACCEPTANCE); + cookieAccessor.Remove(CookieNames.COOKIE_CONSENT_LEVEL); + } + + /// + /// Ensures that the CurrentContact cookie can be created by setting the CMS cookie level to 200 + /// + /// + /// NOTE: In this project, the will return the cookie level to 0 if the contact has not agreed to any consents, but this level is necessary for it to check and adjust cookie levels accordingly. + /// + private void EnsureContactCookieLevel() + { + string cmsCookieLevel = cookieAccessor.Get(CookieNames.CMS_COOKIE_LEVEL); + if (string.IsNullOrWhiteSpace(cmsCookieLevel) || !int.TryParse(cmsCookieLevel, out int cookieLevel) || cookieLevel < 200) + { + cookieAccessor.Set(CookieNames.CMS_COOKIE_LEVEL, "200"); + } + } +} diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index ea78a4b6..9dfcd6e9 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -1,3 +1,4 @@ +using CMS.ContactManagement; using CMS.Core; using Microsoft.AspNetCore.Identity; @@ -8,21 +9,20 @@ public class MembershipService : IMembershipService private readonly SignInManager signInManager; private readonly IHttpContextAccessor contextAccessor; private readonly IEventLogService eventLogService; - - private readonly ICookieAccessor cookieAccessor; + private readonly IMemberContactService memberContactService; public MembershipService( UserManager userManager, SignInManager signInManager, IHttpContextAccessor contextAccessor, IEventLogService eventLogService, - ICookieAccessor cookieAccessor) + IMemberContactService memberContactService) { this.userManager = userManager; this.signInManager = signInManager; this.contextAccessor = contextAccessor; this.eventLogService = eventLogService; - this.cookieAccessor = cookieAccessor; + this.memberContactService = memberContactService; } public async Task GetCurrentMember() @@ -35,6 +35,7 @@ public MembershipService( return await userManager.GetUserAsync(context.User); } + public async Task IsMemberAuthenticated() { var member = await GetCurrentMember(); @@ -56,7 +57,20 @@ public async Task SignIn(string userNameOrEmail, string password, return SignInResult.Failed; } - return await signInManager.PasswordSignInAsync(member.UserName!, password, staySignedIn, false); + var signInResult = await signInManager.PasswordSignInAsync(member.UserName!, password, staySignedIn, false); + + if (signInResult.Succeeded) + { + var contact = ContactManagementContext.GetCurrentContact() ?? new ContactInfo(); + + contact = memberContactService.TransferMemberFieldsToContact(member, contact); + + memberContactService.UpdateContactIfChanged(contact); + + memberContactService.SetCurrentContactForMember(member); + } + + return signInResult; } catch (Exception ex) { @@ -65,18 +79,10 @@ public async Task SignIn(string userNameOrEmail, string password, } } - public async Task SignOut() + public async Task SignOut() { await signInManager.SignOutAsync(); - - RemoveCookies(); - } - private void RemoveCookies() - { - cookieAccessor.Remove(CookieNames.CURRENT_CONTACT); - cookieAccessor.Remove(CookieNames.CMS_COOKIE_LEVEL); - cookieAccessor.Remove(CookieNames.COOKIE_ACCEPTANCE); - cookieAccessor.Remove(CookieNames.COOKIE_CONSENT_LEVEL); + memberContactService.RemoveContactCookies(); } -} \ No newline at end of file +} diff --git a/src/TrainingGuides.Web/Features/Membership/Services/TrainingGuidesMemberToContactMapper.cs b/src/TrainingGuides.Web/Features/Membership/Services/TrainingGuidesMemberToContactMapper.cs new file mode 100644 index 00000000..e4c673d8 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Services/TrainingGuidesMemberToContactMapper.cs @@ -0,0 +1,35 @@ +using CMS; +using CMS.ContactManagement; +using CMS.Membership; + +using Kentico.OnlineMarketing.Web.Mvc; + +using TrainingGuides.Web.Features.Membership.Services; + +[assembly: RegisterImplementation(typeof(IMemberToContactMapper), typeof(TrainingGuidesMemberToContactMapper))] + +namespace TrainingGuides.Web.Features.Membership.Services; +public class TrainingGuidesMemberToContactMapper : IMemberToContactMapper +{ + private readonly IMemberContactService memberContactService; + + public TrainingGuidesMemberToContactMapper(IMemberContactService memberContactService) + { + this.memberContactService = memberContactService; + } + + /// + /// Maps a member to a contact and updates the contact if it has changed + /// + /// The member whose data should be transferred + /// The contact to transfer the data to + public void Map(MemberInfo member, ContactInfo contact) + { + if (member is null || contact is null) + return; + + contact = memberContactService.TransferMemberFieldsToContact(member, contact); + + memberContactService.UpdateContactIfChanged(contact); + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/ServiceCollectionExtensions.cs b/src/TrainingGuides.Web/ServiceCollectionExtensions.cs index 1b69b46f..b99bd624 100644 --- a/src/TrainingGuides.Web/ServiceCollectionExtensions.cs +++ b/src/TrainingGuides.Web/ServiceCollectionExtensions.cs @@ -22,6 +22,7 @@ public static void AddTrainingGuidesServices(this IServiceCollection services) services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); services.AddScoped(); services.AddScoped(); From 6c1aea9bcbedcc16b30b84638487a0a648f89008 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Thu, 14 Nov 2024 15:25:20 -0500 Subject: [PATCH 29/60] GH-89 :: Handle login success with JS and return partial view on error --- .../Membership/Controllers/AuthenticationController.cs | 4 ++-- .../Features/Membership/Widgets/SignIn/SignInWidget.cshtml | 2 +- src/TrainingGuides.Web/Views/Shared/_Layout.cshtml | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index d1101e4c..9447c33d 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -36,7 +36,7 @@ public async Task Authenticate(SignInWidgetViewModel model) var signInResult = await membershipService.SignIn(model.UserNameOrEmail, model.Password, model.StaySignedIn); return signInResult.Succeeded - ? Content("Success!") + ? Json(new { success = true, redirectUrl = model.RedirectUrl }) : RenderError(model); } @@ -48,4 +48,4 @@ public async Task SignOut(SignOutFormModel model) await membershipService.SignOut(); return Redirect(model.RedirectUrl); } -} +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 8157dd85..9c9a217e 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -33,7 +33,7 @@ HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = formDivId, - OnSuccess = $"window.location.href = '{Model.RedirectUrl}'" + OnSuccess = "RedirectOnAuthenticationSuccess(data)" }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) {
diff --git a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml index 6e2c6466..992833df 100644 --- a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml +++ b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml @@ -33,6 +33,13 @@ + From b005ed91b2a6a28217b3f6c54c9340e4d80cda7e Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 14 Nov 2024 15:57:29 -0500 Subject: [PATCH 30/60] GH-86 :: add translations and point registration page link to sign in page --- ...1-4724-93e7-6102dc275b7e_es@040256d42d.xml | 24 +++++++++++++++ ...a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml | 24 +++++++++++++++ ...a-4161-85f2-fd22ef3d4a0b_es@d52a00c387.xml | 28 +++++++++++++++++ ...8-491d-af96-6fa82e073caf_es@aa5becefa8.xml | 30 +++++++++++++++++++ .../es_register_es@85fb997bd8.xml | 26 ++++++++++++++++ ...a.xml => es_registrarse_es@7bbc9f7e2a.xml} | 4 +-- ...ml => es_iniciar-sesion_es@620b1ab686.xml} | 4 +-- .../3c2bab01-988a-4c9c-aadc-1e5bdcccd937.xml | 13 ++++++++ .../890db758-8369-4674-9212-0706460c9438.xml | 13 ++++++++ .../Resources/SharedResources.es.resx | 13 ++++++++ 10 files changed, 175 insertions(+), 4 deletions(-) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/faa53bfd-c32a-4161-85f2-fd22ef3d4a0b_es@d52a00c387.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/2cd492f4-b678-491d-af96-6fa82e073caf_es@aa5becefa8.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/register@bb7b09b4a0/es_register_es@85fb997bd8.xml rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/{es_register_es@7bbc9f7e2a.xml => es_registrarse_es@7bbc9f7e2a.xml} (90%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/{es_sign-in_es@620b1ab686.xml => es_iniciar-sesion_es@620b1ab686.xml} (89%) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e7-6102dc275b7e_es@417495ae81/3c2bab01-988a-4c9c-aadc-1e5bdcccd937.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_c9..eb-09c9d2f08f05_es@ff159aacbd/890db758-8369-4674-9212-0706460c9438.xml diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml new file mode 100644 index 00000000..68f69645 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml @@ -0,0 +1,24 @@ + + + + Register-wfb2l0pn + 67f3dec8-3741-4570-9adb-399a61f47569 + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 2024-11-14 20:30:49Z + bcc0fee2-91f1-4724-93e7-6102dc275b7e + True + 2024-11-14 20:52:14Z + +


"},"fieldIdentifiers":{"content":"b5c0822e-47b2-45ad-bb41-6c8aff165cd3"}}]},{"identifier":"1c125c5a-9016-4e68-bd9d-e09b2d001c3d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fabf2b85-2b37-4c1e-92b3-a718b57581c6","properties":{"unauthenticatedText":"¿Ya tiene una cuenta?","unauthenticatedButtonText":"Iniciar sesión","unauthenticatedTargetContentPage":[{"webPageGuid":"18fe09dc-c0f3-4136-863f-db59732e3658"}],"authenticatedText":"Ya está registrado","authenticatedButtonText":"Cerrar sesión"},"fieldIdentifiers":{"unauthenticatedText":"466b3cbc-8dee-4b03-ae78-4b11346248f0","unauthenticatedButtonText":"0b8b7c48-efb9-4288-a81e-13a805bb34d3","unauthenticatedTargetContentPage":"3ac28b30-e714-45ec-a8c7-e35778dd8469","authenticatedText":"cd9699ae-fd9f-471f-8520-9a00965002db","authenticatedButtonText":"82514014-d110-4c54-8523-9e0274984af0"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9521150d-c46a-4fa7-9313-1fdd4ed8c36c","colorScheme":"187c4225-712c-4f9f-88e0-f9986962bfea","cornerStyle":"6c91ad40-65be-4ece-89a8-b20898afd525","columnLayout":"b754983b-2cb9-4bad-a629-e768046b1114"}}]}]}]]> +
+ + + + 2 +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml new file mode 100644 index 00000000..0886b68b --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml @@ -0,0 +1,24 @@ + + + + SignIn-x4a1nygh + 4f88daba-f579-43fb-acdd-d80c43d7317a + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 2024-11-14 20:48:13Z + c9c07ec5-c40a-4a78-89eb-09c9d2f08f05 + True + 2024-11-14 20:48:13Z + + + + + + + 2 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/faa53bfd-c32a-4161-85f2-fd22ef3d4a0b_es@d52a00c387.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/faa53bfd-c32a-4161-85f2-fd22ef3d4a0b_es@d52a00c387.xml new file mode 100644 index 00000000..a7be3e13 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/register-wfb2l0pn@9811dc3c9c/faa53bfd-c32a-4161-85f2-fd22ef3d4a0b_es@d52a00c387.xml @@ -0,0 +1,28 @@ + + + + Register-wfb2l0pn + 67f3dec8-3741-4570-9adb-399a61f47569 + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-14 20:23:53Z + Registrarse + faa53bfd-c32a-4161-85f2-fd22ef3d4a0b + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/2cd492f4-b678-491d-af96-6fa82e073caf_es@aa5becefa8.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/2cd492f4-b678-491d-af96-6fa82e073caf_es@aa5becefa8.xml new file mode 100644 index 00000000..150b8966 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/signin-x4a1nygh@e4708c2853/2cd492f4-b678-491d-af96-6fa82e073caf_es@aa5becefa8.xml @@ -0,0 +1,30 @@ + + + + SignIn-x4a1nygh + 4f88daba-f579-43fb-acdd-d80c43d7317a + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-14 20:32:56Z + + + + 2cd492f4-b678-491d-af96-6fa82e073caf + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/register@bb7b09b4a0/es_register_es@85fb997bd8.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/register@bb7b09b4a0/es_register_es@85fb997bd8.xml new file mode 100644 index 00000000..2fb9ebe0 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/register@bb7b09b4a0/es_register_es@85fb997bd8.xml @@ -0,0 +1,26 @@ + + + es/Register + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + Register-wfb2l0pn + 9008b16a-3a70-41c9-92ba-2d289c940e2f + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_register_es@7bbc9f7e2a.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_registrarse_es@7bbc9f7e2a.xml similarity index 90% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_register_es@7bbc9f7e2a.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_registrarse_es@7bbc9f7e2a.xml index e5c5692f..90282154 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_register_es@7bbc9f7e2a.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_registrarse_es@7bbc9f7e2a.xml @@ -1,6 +1,6 @@  - es/Register + es/Registrarse es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ 265f57e1-a961-45e7-9119-867782ae0ea6 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_sign-in_es@620b1ab686.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_iniciar-sesion_es@620b1ab686.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_sign-in_es@620b1ab686.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_iniciar-sesion_es@620b1ab686.xml index e1bbc6de..08abb52d 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_sign-in_es@620b1ab686.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_iniciar-sesion_es@620b1ab686.xml @@ -1,6 +1,6 @@  - es/Sign-in + es/Iniciar-sesion es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ a7bbb92d-4ea8-4d71-b99e-852098ccd504 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e7-6102dc275b7e_es@417495ae81/3c2bab01-988a-4c9c-aadc-1e5bdcccd937.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e7-6102dc275b7e_es@417495ae81/3c2bab01-988a-4c9c-aadc-1e5bdcccd937.xml new file mode 100644 index 00000000..a6a52121 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/register-wfb2l0pn_..e7-6102dc275b7e_es@417495ae81/3c2bab01-988a-4c9c-aadc-1e5bdcccd937.xml @@ -0,0 +1,13 @@ + + + + bcc0fee2-91f1-4724-93e7-6102dc275b7e + cms.contentitemcommondata + + Register-wfb2l0pn + 67f3dec8-3741-4570-9adb-399a61f47569 + cms.contentitem + + + 3c2bab01-988a-4c9c-aadc-1e5bdcccd937 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_c9..eb-09c9d2f08f05_es@ff159aacbd/890db758-8369-4674-9212-0706460c9438.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_c9..eb-09c9d2f08f05_es@ff159aacbd/890db758-8369-4674-9212-0706460c9438.xml new file mode 100644 index 00000000..8d498b75 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/signin-x4a1nygh_c9..eb-09c9d2f08f05_es@ff159aacbd/890db758-8369-4674-9212-0706460c9438.xml @@ -0,0 +1,13 @@ + + + + c9c07ec5-c40a-4a78-89eb-09c9d2f08f05 + cms.contentitemcommondata + + SignIn-x4a1nygh + 4f88daba-f579-43fb-acdd-d80c43d7317a + cms.contentitem + + + 890db758-8369-4674-9212-0706460c9438 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Resources/SharedResources.es.resx b/src/TrainingGuides.Web/Resources/SharedResources.es.resx index 054a291a..b93ab743 100644 --- a/src/TrainingGuides.Web/Resources/SharedResources.es.resx +++ b/src/TrainingGuides.Web/Resources/SharedResources.es.resx @@ -149,4 +149,17 @@ Cookies de marketing + + + Iniciar sesión + + + Cerrar sesión + + + ¡Éxito! + + + Error en el registro. + \ No newline at end of file From 1719ca2287dcc57535ef2956a89cc588bd2546a0 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Thu, 14 Nov 2024 17:18:56 -0500 Subject: [PATCH 31/60] GH-89 :: fix the order of middlewares, wrap authentication js in VC --- .../AuthenticationScripts/AuthenticationScripts.cshtml | 2 ++ .../AuthenticationScriptsScriptsViewComponent.cs | 9 +++++++++ src/TrainingGuides.Web/Program.cs | 4 +--- src/TrainingGuides.Web/Views/Shared/_Layout.cshtml | 4 +++- .../wwwroot/assets/js/authenticationScripts.js | 5 +++++ 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs create mode 100644 src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml b/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml new file mode 100644 index 00000000..7bb8bbb3 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml @@ -0,0 +1,2 @@ +@*Scripts for handling redirect after successful authentication*@ + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs new file mode 100644 index 00000000..3dafc1e6 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs @@ -0,0 +1,9 @@ +using Microsoft.AspNetCore.Mvc; + +namespace TrainingGuides.Web.Features.Membership.ViewComponents.AuthenticationScripts; +public class AuthenticationScriptsViewComponent : ViewComponent +{ + public AuthenticationScriptsViewComponent() + { } + public IViewComponentResult Invoke() => View("~/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml"); +} diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index f4476919..50031fdc 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -108,12 +108,10 @@ app.InitKentico(); app.UseStaticFiles(); -app.UseKentico(); app.UseCookiePolicy(); - app.UseAuthentication(); - +app.UseKentico(); app.UseAuthorization(); app.Kentico().MapRoutes(); diff --git a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml index 992833df..4d77f814 100644 --- a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml +++ b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml @@ -85,7 +85,9 @@ - + + + diff --git a/src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js b/src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js new file mode 100644 index 00000000..8d35bc21 --- /dev/null +++ b/src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js @@ -0,0 +1,5 @@ +function RedirectOnAuthenticationSuccess(result) { + if (result.success) { + window.location.href = result.redirectUrl; + } +} \ No newline at end of file From 52d5929b8dff8ed5d89b44dff6c32b0569548f5f Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Fri, 15 Nov 2024 12:04:07 -0500 Subject: [PATCH 32/60] GH-89 :: remove unused parameter and nuget package. make the Sign in widget view model inherit from WidgetViewModel --- .../SignIn/SignInWidgetViewModelTests.cs | 61 +++++++++++++++++++ .../packages.lock.json | 10 --- .../Widgets/SignIn/SignInWidget.cshtml | 16 ++--- .../Widgets/SignIn/SignInWidgetViewModel.cs | 9 ++- .../Services/ContentItemRetrieverService.cs | 7 +-- .../TrainingGuides.Web.csproj | 1 - src/TrainingGuides.Web/packages.lock.json | 9 --- 7 files changed, 75 insertions(+), 38 deletions(-) diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs index fb91ef9f..bef3caae 100644 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs @@ -44,4 +44,65 @@ public SignInWidgetViewModelTests() [Fact] public void WhenModelInitialized_StaySignedIn_IsFalse() => Assert.False(viewModel.StaySignedIn); + + [Fact] + public void IsMisconfigured_WhenBaseUrlAndAllLabelsAreSet_ReturnsFalse() + { + var viewModelAllFieldsSet = new SignInWidgetViewModel + { + BaseUrl = "https://www.example.com", + SubmitButtonText = "Submit", + UserNameOrEmailLabel = "Username", + PasswordLabel = "Password", + StaySignedInLabel = "Stay signed in" + }; + + Assert.False(viewModelAllFieldsSet.IsMisconfigured); + } + + [Fact] + public void IsMisconfigured_WhenBaseUrlAnyLabelIsMissing_ReturnsTrue() + { + var viewModelBaseUrlMissing = new SignInWidgetViewModel + { + SubmitButtonText = "Submit", + UserNameOrEmailLabel = "Username", + PasswordLabel = "Password", + StaySignedInLabel = "Stay signed in" + }; + var viewModelSubmitButtonTextMissing = new SignInWidgetViewModel + { + BaseUrl = "https://www.example.com", + UserNameOrEmailLabel = "Username", + PasswordLabel = "Password", + StaySignedInLabel = "Stay signed in" + }; + var viewModelUserNameOrEmailLabelMissing = new SignInWidgetViewModel + { + BaseUrl = "https://www.example.com", + SubmitButtonText = "Submit", + PasswordLabel = "Password", + StaySignedInLabel = "Stay signed in" + }; + var viewModelPasswordLabelMissing = new SignInWidgetViewModel + { + BaseUrl = "https://www.example.com", + SubmitButtonText = "Submit", + UserNameOrEmailLabel = "Username", + StaySignedInLabel = "Stay signed in" + }; + var viewModelStaySignedInLabelMissing = new SignInWidgetViewModel + { + BaseUrl = "https://www.example.com", + SubmitButtonText = "Submit", + UserNameOrEmailLabel = "Username", + PasswordLabel = "Password" + }; + Assert.True(viewModel.IsMisconfigured); + Assert.True(viewModelBaseUrlMissing.IsMisconfigured); + Assert.True(viewModelSubmitButtonTextMissing.IsMisconfigured); + Assert.True(viewModelUserNameOrEmailLabelMissing.IsMisconfigured); + Assert.True(viewModelPasswordLabelMissing.IsMisconfigured); + Assert.True(viewModelStaySignedInLabelMissing.IsMisconfigured); + } } \ No newline at end of file diff --git a/src/TrainingGuides.Web.Tests/packages.lock.json b/src/TrainingGuides.Web.Tests/packages.lock.json index 8503ccd5..93839eb2 100644 --- a/src/TrainingGuides.Web.Tests/packages.lock.json +++ b/src/TrainingGuides.Web.Tests/packages.lock.json @@ -988,7 +988,6 @@ "dependencies": { "AspNetCore.Unobtrusive.Ajax": "[2.0.0, )", "Enums.NET": "[4.0.2, )", - "Htmx": "[1.8.0, )", "TrainingGuides.Admin": "[1.0.0, )", "TrainingGuides.Entities": "[1.0.0, )", "kentico.xperience.admin": "[29.6.1, )", @@ -1012,15 +1011,6 @@ "resolved": "4.0.2", "contentHash": "Nwa4XxZ7fsuh9SpMiLUXmFT+NntALGXEvufLaQT+A0bQUH5ToNTtG0QDCoCiChdhp+4F/rtwyxpoJSgDmObIXg==" }, - "Htmx": { - "type": "CentralTransitive", - "requested": "[1.8.0, )", - "resolved": "1.8.0", - "contentHash": "bdsdNw8RWcj8HmoD9qmVHDf9F/xbN9ac3xsHu8dMekj2jLQFzu6sQiry4cE7Od7rokgL819qW9gNOUkee1Hgfg==", - "dependencies": { - "System.Text.Json": "6.0.5" - } - }, "Kentico.Xperience.Admin": { "type": "CentralTransitive", "requested": "[29.6.1, )", diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 9c9a217e..432e0f0d 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -2,18 +2,7 @@ @model SignInWidgetViewModel -@{ - // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. - var formDivId = $"signInForm{Guid.NewGuid()}"; - - bool isMisconfigured = Model == null - || string.IsNullOrWhiteSpace(Model.BaseUrl) - || string.IsNullOrWhiteSpace(Model.SubmitButtonText) - || string.IsNullOrWhiteSpace(Model.UserNameOrEmailLabel) - || string.IsNullOrWhiteSpace(Model.PasswordLabel) - || string.IsNullOrWhiteSpace(Model.StaySignedInLabel); -} -@if (isMisconfigured) +@if (Model == null || Model.IsMisconfigured) { @@ -28,6 +17,9 @@ @if(Model.DisplayForm) { + // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. + var formDivId = $"signInForm{Guid.NewGuid()}"; + @using (Html.AjaxBeginForm("Autheticate", "Authentication", new AjaxOptions { HttpMethod = "POST", diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index 23afd590..e58d3126 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -1,9 +1,10 @@ using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Shared.Models; namespace TrainingGuides.Web.Features.Membership.Widgets.SignIn; -public class SignInWidgetViewModel +public class SignInWidgetViewModel : WidgetViewModel { //WIDGET DISPLAY PROPERTIES @@ -68,4 +69,10 @@ public class SignInWidgetViewModel public string Password { get; set; } = string.Empty; public bool StaySignedIn { get; set; } = false; + + public override bool IsMisconfigured => string.IsNullOrWhiteSpace(BaseUrl) + || string.IsNullOrWhiteSpace(SubmitButtonText) + || string.IsNullOrWhiteSpace(UserNameOrEmailLabel) + || string.IsNullOrWhiteSpace(PasswordLabel) + || string.IsNullOrWhiteSpace(StaySignedInLabel); } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs index 675d1e32..811cd3f8 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs @@ -245,17 +245,14 @@ public async Task> RetrieveContentItemsByS return await RetrieveContentItems(contentQueryParameters, contentTypesQueryParameters); } - private async Task> RetrieveWebPages(Action parameters, string? pathToMatch = null) + private async Task> RetrieveWebPages(Action parameters) { var builder = new ContentItemQueryBuilder(); builder .ForContentTypes(query => { - if (pathToMatch == null) - query.ForWebsite(websiteChannelContext.WebsiteChannelName); - else - query.ForWebsite(websiteChannelContext.WebsiteChannelName, PathMatch.Single(pathToMatch)); + query.ForWebsite(websiteChannelContext.WebsiteChannelName); }) .Parameters(parameters); diff --git a/src/TrainingGuides.Web/TrainingGuides.Web.csproj b/src/TrainingGuides.Web/TrainingGuides.Web.csproj index 956b0d1e..f54bb5f7 100644 --- a/src/TrainingGuides.Web/TrainingGuides.Web.csproj +++ b/src/TrainingGuides.Web/TrainingGuides.Web.csproj @@ -3,7 +3,6 @@ - diff --git a/src/TrainingGuides.Web/packages.lock.json b/src/TrainingGuides.Web/packages.lock.json index 0dad5591..6d8d5511 100644 --- a/src/TrainingGuides.Web/packages.lock.json +++ b/src/TrainingGuides.Web/packages.lock.json @@ -17,15 +17,6 @@ "resolved": "4.0.2", "contentHash": "Nwa4XxZ7fsuh9SpMiLUXmFT+NntALGXEvufLaQT+A0bQUH5ToNTtG0QDCoCiChdhp+4F/rtwyxpoJSgDmObIXg==" }, - "Htmx": { - "type": "Direct", - "requested": "[1.8.0, )", - "resolved": "1.8.0", - "contentHash": "bdsdNw8RWcj8HmoD9qmVHDf9F/xbN9ac3xsHu8dMekj2jLQFzu6sQiry4cE7Od7rokgL819qW9gNOUkee1Hgfg==", - "dependencies": { - "System.Text.Json": "6.0.5" - } - }, "Kentico.Xperience.Admin": { "type": "Direct", "requested": "[29.6.1, )", From e931ee18a6558ec93ba23b511ce0f44ccf251fef Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Fri, 15 Nov 2024 14:14:41 -0500 Subject: [PATCH 33/60] GH-86 :: refactoring --- .../Services/MemberContactServiceTests.cs | 143 ++++++++++++++++++ .../RegistrationWidgetViewComponentTests.cs | 94 ++++++++++++ .../ComponentIdentifiers.cs | 2 + .../Features/Membership/GuidesMember.cs | 10 +- .../Services/MemberContactService.cs | 14 +- .../LinkOrSignOut/LinkOrSignOutWidget.cshtml | 2 +- .../LinkOrSignOutWidgetViewModel.cs | 7 +- .../Registration/RegistrationWidget.cshtml | 12 +- .../RegistrationWidgetViewComponent.cs | 9 +- .../RegistrationWidgetViewModel.cs | 52 ++++--- src/TrainingGuides.Web/Program.cs | 4 +- 11 files changed, 301 insertions(+), 48 deletions(-) create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs new file mode 100644 index 00000000..966f4ac7 --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs @@ -0,0 +1,143 @@ +using CMS.ContactManagement; +using CMS.DataEngine; +using Kentico.Web.Mvc; +using Moq; +using TrainingGuides.Web.Features.Membership; +using TrainingGuides.Web.Features.Membership.Services; +using Xunit; + +namespace TrainingGuides.Web.Tests.Features.Membership.Services; + +public class MemberContactServiceTests +{ + private readonly Mock> contactInfoProviderMock; + private readonly Mock cookieAccessorMock; + private readonly Mock currentContactProviderMock; + + private const string GIVEN_NAME = "John"; + private const string FAMILY_NAME = "Doe"; + private const string EMAIL_1 = "JohnDoe@localhost.local"; + private const string EMAIL_2 = "NotJohnDoe@localhost.local"; + + public MemberContactServiceTests() + { + contactInfoProviderMock = new Mock>(); + cookieAccessorMock = new Mock(); + currentContactProviderMock = new Mock(); + } + + private ContactInfo BuildSampleContactInfo(string firstName, string lastName, string email) => + new() + { + ContactFirstName = firstName, + ContactLastName = lastName, + ContactEmail = email, + ContactID = 1, + ContactGUID = Guid.NewGuid() + }; + + private GuidesMember BuildSampleGuidesMember(string givenName, string familyName, string email) => + new() + { + GivenName = givenName, + FamilyName = familyName, + Email = email, + Id = 1, + }; + + [Fact] + public void TransferMemberFieldsToContact_Does_Not_Overwrite_Email() + { + // Arrange + var memberContactService = new MemberContactService( + contactInfoProvider: contactInfoProviderMock.Object, + cookieAccessor: cookieAccessorMock.Object, + currentContactProvider: currentContactProviderMock.Object); + + var guidesMember = BuildSampleGuidesMember( + givenName: GIVEN_NAME, + familyName: FAMILY_NAME, + email: EMAIL_1); + + var contact = BuildSampleContactInfo( + firstName: GIVEN_NAME, + lastName: FAMILY_NAME, + email: EMAIL_2); + + var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + Assert.NotEqual(guidesMember.Email, newContact.ContactEmail); + } + + [Fact] + public void TransferMemberFieldsToContact_Overwrites_Blank_Email() + { + // Arrange + var memberContactService = new MemberContactService( + contactInfoProvider: contactInfoProviderMock.Object, + cookieAccessor: cookieAccessorMock.Object, + currentContactProvider: currentContactProviderMock.Object); + + var guidesMember = BuildSampleGuidesMember( + givenName: GIVEN_NAME, + familyName: FAMILY_NAME, + email: EMAIL_1); + + var contact = BuildSampleContactInfo( + firstName: GIVEN_NAME, + lastName: FAMILY_NAME, + email: string.Empty); + + var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + Assert.Equal(guidesMember.Email, newContact.ContactEmail); + } + + [Fact] + public void TransferMemberFieldsToContact_Overwrites_FirstName() + { + // Arrange + var memberContactService = new MemberContactService( + contactInfoProvider: contactInfoProviderMock.Object, + cookieAccessor: cookieAccessorMock.Object, + currentContactProvider: currentContactProviderMock.Object); + + var guidesMember = BuildSampleGuidesMember( + givenName: GIVEN_NAME, + familyName: FAMILY_NAME, + email: EMAIL_1); + + var contact = BuildSampleContactInfo( + firstName: GIVEN_NAME, + lastName: FAMILY_NAME, + email: string.Empty); + + var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + Assert.Equal(guidesMember.GivenName, newContact.ContactFirstName); + } + + [Fact] + public void TransferMemberFieldsToContact_Overwrites_LastName() + { + // Arrange + var memberContactService = new MemberContactService( + contactInfoProvider: contactInfoProviderMock.Object, + cookieAccessor: cookieAccessorMock.Object, + currentContactProvider: currentContactProviderMock.Object); + + var guidesMember = BuildSampleGuidesMember( + givenName: GIVEN_NAME, + familyName: FAMILY_NAME, + email: EMAIL_1); + + var contact = BuildSampleContactInfo( + firstName: GIVEN_NAME, + lastName: FAMILY_NAME, + email: string.Empty); + + var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + Assert.Equal(guidesMember.FamilyName, newContact.ContactLastName); + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs new file mode 100644 index 00000000..03a00384 --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs @@ -0,0 +1,94 @@ +using Moq; +using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Widgets.Registration; +using TrainingGuides.Web.Features.Shared.Services; +using Xunit; + +namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.Registration; +public class RegistrationWidgetViewComponentTests +{ + private readonly RegistrationWidgetViewComponent viewComponent; + private readonly Mock httpRequestServiceMock; + private readonly Mock membershipServiceMock; + private readonly RegistrationWidgetProperties referenceProperties; + + private const string FORM_TITLE = "Register"; + private const string SUBMIT_BUTTON_TEXT = "Submit"; + private const string USERNAME_LABEL = "Username"; + private const string EMAIL_ADDRESS_LABEL = "Email"; + private const string PASSWORD_LABEL = "Password"; + private const string CONFIRM_PASSWORD_LABEL = "Confirm Password"; + private const string GIVEN_NAME_LABEL = "Given Name"; + private const string FAMILY_NAME_LABEL = "Family Name"; + private const string FAMILY_NAME_FIRST_LABEL = "Family Name First"; + private const string FAVORITE_COFFEE_LABEL = "Favorite Coffee"; + private const string BASE_URL = "http://localhost:5000"; + + public RegistrationWidgetViewComponentTests() + { + httpRequestServiceMock = new Mock(); + httpRequestServiceMock.Setup(x => x.GetBaseUrl()).Returns(BASE_URL); + + membershipServiceMock = new Mock(); + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); + + viewComponent = new RegistrationWidgetViewComponent(httpRequestServiceMock.Object, membershipServiceMock.Object); + + referenceProperties = new RegistrationWidgetProperties() + { + FormTitle = FORM_TITLE, + SubmitButtonText = SUBMIT_BUTTON_TEXT, + UserNameLabel = USERNAME_LABEL, + EmailAddressLabel = EMAIL_ADDRESS_LABEL, + PasswordLabel = PASSWORD_LABEL, + ConfirmPasswordLabel = CONFIRM_PASSWORD_LABEL, + ShowName = true, + ShowExtraFields = true, + GivenNameLabel = GIVEN_NAME_LABEL, + FamilyNameLabel = FAMILY_NAME_LABEL, + FamilyNameFirstLabel = FAMILY_NAME_FIRST_LABEL, + FavoriteCoffeeLabel = FAVORITE_COFFEE_LABEL + }; + } + + [Fact] + public async Task BuildWidgetViewModel_ReturnsWidgetViewModel_WithBaseUrlSet() + { + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.NotEmpty(viewModel.BaseUrl); + } + + [Fact] + public async Task BuildWidgetViewModel_WhenUserIsAuthenticated_SetsDisplayForm_ToFalse() + { + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); + + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.False(viewModel.DisplayForm); + } + + [Fact] + public async Task BuildWidgetViewModel_WhenUserIsNOTAuthenticated_SetsDisplayForm_ToTrue() + { + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(false); + + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.True(viewModel.DisplayForm); + } + + [Fact] + public async Task BuildWidgetViewModel_SetsFormLabels_BasedOnWidgetProperties() + { + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.Equal(referenceProperties.FormTitle, viewModel.FormTitle); + Assert.Equal(referenceProperties.SubmitButtonText, viewModel.SubmitButtonText); + Assert.Equal(referenceProperties.UserNameLabel, viewModel.UserNameLabel); + Assert.Equal(referenceProperties.EmailAddressLabel, viewModel.EmailAddressLabel); + Assert.Equal(referenceProperties.PasswordLabel, viewModel.PasswordLabel); + Assert.Equal(referenceProperties.ConfirmPasswordLabel, viewModel.ConfirmPasswordLabel); + Assert.Equal(referenceProperties.GivenNameLabel, viewModel.GivenNameLabel); + Assert.Equal(referenceProperties.FamilyNameLabel, viewModel.FamilyNameLabel); + Assert.Equal(referenceProperties.FamilyNameFirstLabel, viewModel.FamilyNameFirstLabel); + Assert.Equal(referenceProperties.FavoriteCoffeeLabel, viewModel.FavoriteCoffeeLabel); + } +} diff --git a/src/TrainingGuides.Web/ComponentIdentifiers.cs b/src/TrainingGuides.Web/ComponentIdentifiers.cs index 15eb448e..0885b0c4 100644 --- a/src/TrainingGuides.Web/ComponentIdentifiers.cs +++ b/src/TrainingGuides.Web/ComponentIdentifiers.cs @@ -5,6 +5,7 @@ using TrainingGuides.Web.Features.LandingPages.Widgets.CallToAction; using TrainingGuides.Web.Features.LandingPages.Widgets.HeroBanner; using TrainingGuides.Web.Features.LandingPages.Widgets.SimpleCallToAction; +using TrainingGuides.Web.Features.Membership.Widgets.Registration; using TrainingGuides.Web.Features.Membership.Widgets.SignIn; using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; using TrainingGuides.Web.Features.Products.Widgets.Product; @@ -40,6 +41,7 @@ public static class Widgets public const string VIDEO_EMBED = VideoEmbedWidgetViewComponent.IDENTIFIER; public const string SING_IN = SignInWidgetViewComponent.IDENTIFIER; public const string LINK_OR_SIGN_OUT = LinkOrSignOutWidgetViewComponent.IDENTIFIER; + public const string REGISTRATION = RegistrationWidgetViewComponent.IDENTIFIER; } } diff --git a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs index c7c90c84..61e12822 100644 --- a/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs +++ b/src/TrainingGuides.Web/Features/Membership/GuidesMember.cs @@ -5,21 +5,21 @@ namespace TrainingGuides.Web.Features.Membership; public class GuidesMember : ApplicationUser { - public string GivenName { get; set; } = ""; - public string FamilyName { get; set; } = ""; + public string GivenName { get; set; } = string.Empty; + public string FamilyName { get; set; } = string.Empty; public bool FamilyNameFirst { get; set; } = false; public string FullName => (GivenName, FamilyName) switch { - ("", "") => "", + ("", "") => string.Empty, (string given, "") => given, ("", string family) => family, (string given, string family) => FamilyNameFirst ? $"{family} {given}" : $"{given} {family}", - (null, null) or _ => "", + (null, null) or _ => string.Empty, }; - public string FavoriteCoffee { get; set; } = ""; + public string FavoriteCoffee { get; set; } = string.Empty; public DateTime Created { get; set; } diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs index b173ae94..8d06c7eb 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs @@ -32,29 +32,31 @@ public ContactInfo TransferMemberFieldsToContact(MemberInfo member, ContactInfo /// public ContactInfo TransferMemberFieldsToContact(GuidesMember guidesMember, ContactInfo contact) { + var newContact = contact.Clone(); + if (!string.IsNullOrWhiteSpace(guidesMember.GivenName)) { - contact.ContactFirstName = guidesMember.GivenName; + newContact.ContactFirstName = guidesMember.GivenName; } if (!string.IsNullOrWhiteSpace(guidesMember.FamilyName)) { - _ = contact.ContactLastName = guidesMember.FamilyName; + newContact.ContactLastName = guidesMember.FamilyName; } if (!string.IsNullOrWhiteSpace(guidesMember.FavoriteCoffee)) { - _ = contact.SetValue("TrainingGuidesContactFavoriteCoffee", guidesMember.FavoriteCoffee); + _ = newContact.SetValue("TrainingGuidesContactFavoriteCoffee", guidesMember.FavoriteCoffee); } // Sets the Member ID of the current contact - contact.SetValue("TrainingGuidesContactMemberId", guidesMember.Id); + _ = newContact.SetValue("TrainingGuidesContactMemberId", guidesMember.Id); // For data security, do not overwrite contact email address if it is already set if (string.IsNullOrWhiteSpace(contact.ContactEmail) && !string.IsNullOrWhiteSpace(guidesMember.Email)) { - contact.ContactEmail = guidesMember.Email; + newContact.ContactEmail = guidesMember.Email; } - return contact; + return newContact; } /// diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml index 63f4a6d1..b17a2571 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml @@ -1,7 +1,7 @@ @using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; @model LinkOrSignOutWidgetViewModel -@if (Model == null || string.IsNullOrWhiteSpace(Model.ButtonText) || string.IsNullOrWhiteSpace(Model.Url)) +@if (Model == null || Model.IsMisconfigured) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs index c5b0bfd0..f6c076c0 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs @@ -1,7 +1,12 @@ +using TrainingGuides.Web.Features.Shared.Models; + namespace TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; -public class LinkOrSignOutWidgetViewModel +public class LinkOrSignOutWidgetViewModel : WidgetViewModel { + public override bool IsMisconfigured => + string.IsNullOrWhiteSpace(ButtonText) + || string.IsNullOrWhiteSpace(Url); public string Text { get; set; } = string.Empty; public string ButtonText { get; set; } = string.Empty; public string Url { get; set; } = string.Empty; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index 71e389eb..2b3f75a6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -5,19 +5,9 @@ @{ // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. var formDivId = $"registerForm{Guid.NewGuid()}"; - - bool isMisconfigured = Model == null - || string.IsNullOrWhiteSpace(Model.BaseUrl) - || string.IsNullOrWhiteSpace(Model.SubmitButtonText) - || string.IsNullOrWhiteSpace(Model.UserNameLabel) - || string.IsNullOrWhiteSpace(Model.EmailAddressLabel) - || string.IsNullOrWhiteSpace(Model.PasswordLabel) - || string.IsNullOrWhiteSpace(Model.ConfirmPasswordLabel) - || (Model.ShowName && (string.IsNullOrWhiteSpace(Model.GivenNameLabel) || string.IsNullOrWhiteSpace(Model.FamilyNameLabel) || string.IsNullOrWhiteSpace(Model.FamilyNameFirstLabel))) - || (Model.ShowExtraFields && string.IsNullOrWhiteSpace(Model.FavoriteCoffeeLabel)); } -@if (isMisconfigured) +@if (Model == null || Model.IsMisconfigured) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs index 7d4904ea..1bc9c233 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -29,9 +29,8 @@ public RegistrationWidgetViewComponent(IHttpRequestService httpRequestService, I this.membershipService = membershipService; } - public async Task InvokeAsync(RegistrationWidgetProperties properties) - { - var registerModel = new RegistrationWidgetViewModel + public async Task BuildWidgetViewModel(RegistrationWidgetProperties properties) => + new() { BaseUrl = httpRequestService.GetBaseUrl(), DisplayForm = !await membershipService.IsMemberAuthenticated(), @@ -49,6 +48,10 @@ public async Task InvokeAsync(RegistrationWidgetProperties FavoriteCoffeeLabel = properties.FavoriteCoffeeLabel }; + public async Task InvokeAsync(RegistrationWidgetProperties properties) + { + var registerModel = await BuildWidgetViewModel(properties); + return View("~/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml", registerModel); } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs index 79af10cd..05918836 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs @@ -1,16 +1,30 @@ using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Shared.Models; // using TrainingGuides.Web.Features.Membership.Widgets.Registration; -public class RegistrationWidgetViewModel +public class RegistrationWidgetViewModel : WidgetViewModel { //WIDGET DISPLAY PROPERTIES + /// + /// Determines whether the widget is misconfigured. + /// + public override bool IsMisconfigured => + string.IsNullOrWhiteSpace(BaseUrl) + || string.IsNullOrWhiteSpace(SubmitButtonText) + || string.IsNullOrWhiteSpace(UserNameLabel) + || string.IsNullOrWhiteSpace(EmailAddressLabel) + || string.IsNullOrWhiteSpace(PasswordLabel) + || string.IsNullOrWhiteSpace(ConfirmPasswordLabel) + || (ShowName && (string.IsNullOrWhiteSpace(GivenNameLabel) || string.IsNullOrWhiteSpace(FamilyNameLabel) || string.IsNullOrWhiteSpace(FamilyNameFirstLabel))) + || (ShowExtraFields && string.IsNullOrWhiteSpace(FavoriteCoffeeLabel)); + /// /// The Base URL of the site /// [HiddenInput] - public string BaseUrl { get; set; } = ""; + public string BaseUrl { get; set; } = string.Empty; /// /// Determines whether the widget should display the form. @@ -34,61 +48,61 @@ public class RegistrationWidgetViewModel /// Form title /// [HiddenInput] - public string FormTitle { get; set; } = ""; + public string FormTitle { get; set; } = string.Empty; /// /// Submit button text /// [HiddenInput] - public string SubmitButtonText { get; set; } = ""; + public string SubmitButtonText { get; set; } = string.Empty; /// /// User name label. /// [HiddenInput] - public string UserNameLabel { get; set; } = ""; + public string UserNameLabel { get; set; } = string.Empty; /// /// Email address label. /// [HiddenInput] - public string EmailAddressLabel { get; set; } = ""; + public string EmailAddressLabel { get; set; } = string.Empty; /// /// Password label. /// [HiddenInput] - public string PasswordLabel { get; set; } = ""; + public string PasswordLabel { get; set; } = string.Empty; /// /// Password label. /// [HiddenInput] - public string ConfirmPasswordLabel { get; set; } = ""; + public string ConfirmPasswordLabel { get; set; } = string.Empty; /// /// Given name label. /// [HiddenInput] - public string GivenNameLabel { get; set; } = ""; + public string GivenNameLabel { get; set; } = string.Empty; /// /// Family name label. /// [HiddenInput] - public string FamilyNameLabel { get; set; } = ""; + public string FamilyNameLabel { get; set; } = string.Empty; /// /// Label for checkbox that indicates that the family name should display first. /// [HiddenInput] - public string FamilyNameFirstLabel { get; set; } = ""; + public string FamilyNameFirstLabel { get; set; } = string.Empty; /// /// Favorite coffee label. /// [HiddenInput] - public string FavoriteCoffeeLabel { get; set; } = ""; + public string FavoriteCoffeeLabel { get; set; } = string.Empty; //FORM PROPERTIES @@ -96,36 +110,36 @@ public class RegistrationWidgetViewModel [Required()] [RegularExpression("^[a-zA-Z0-9_\\-\\.]+$")] [MaxLength(100)] - public string UserName { get; set; } = ""; + public string UserName { get; set; } = string.Empty; [DataType(DataType.EmailAddress)] [Required()] [EmailAddress()] [MaxLength(100)] - public string EmailAddress { get; set; } = ""; + public string EmailAddress { get; set; } = string.Empty; [DataType(DataType.Password)] [Required()] [MaxLength(100)] - public string Password { get; set; } = ""; + public string Password { get; set; } = string.Empty; [DataType(DataType.Password)] [Required()] [MaxLength(100)] [Compare(nameof(Password))] - public string ConfirmPassword { get; set; } = ""; + public string ConfirmPassword { get; set; } = string.Empty; [DataType(DataType.Text)] [MaxLength(100)] - public string GivenName { get; set; } = ""; + public string GivenName { get; set; } = string.Empty; [DataType(DataType.Text)] [MaxLength(100)] - public string FamilyName { get; set; } = ""; + public string FamilyName { get; set; } = string.Empty; public bool FamilyNameFirst { get; set; } = false; [DataType(DataType.Text)] [MaxLength(100)] - public string FavoriteCoffee { get; set; } = ""; + public string FavoriteCoffee { get; set; } = string.Empty; } diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 50031fdc..56f8dd03 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -82,8 +82,8 @@ builder.Services .AddIdentity(options => { - options.SignIn.RequireConfirmedAccount = false; - options.User.RequireUniqueEmail = false;//change this once we add email functionality + options.SignIn.RequireConfirmedAccount = false;//TODO: change this once we add email functionality + options.User.RequireUniqueEmail = true; }) .AddUserStore>() .AddRoleStore() From ddf7a96cf9926ca336f13e9bd6d54c246964ce29 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Fri, 15 Nov 2024 15:41:28 -0500 Subject: [PATCH 34/60] GH-89 :: Sign up and Sign in - add some styling --- .../720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml | 6 +++--- .../bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml | 6 +++--- .../46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml | 6 +++--- .../c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml | 6 +++--- .../Widgets/CallToAction/CallToActionWidgetViewModel.cs | 1 - .../Membership/Widgets/Registration/RegistrationForm.cshtml | 5 +++-- .../Widgets/Registration/RegistrationWidget.cshtml | 4 ++-- .../Features/Membership/Widgets/SignIn/SignInWidget.cshtml | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml index 9ebdd679..54e2944e 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/720f4866-de8d-4fbb-84e2-b146431792ab_en@8cb2345696.xml @@ -13,12 +13,12 @@ 2024-11-12 21:22:13Z 720f4866-de8d-4fbb-84e2-b146431792ab True - 2024-11-13 13:11:23Z + 2024-11-15 20:40:08Z -


"},"fieldIdentifiers":{"content":"b5c0822e-47b2-45ad-bb41-6c8aff165cd3"}}]},{"identifier":"1c125c5a-9016-4e68-bd9d-e09b2d001c3d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fabf2b85-2b37-4c1e-92b3-a718b57581c6","properties":{"unauthenticatedText":"Already have an account?","unauthenticatedButtonText":"Sign in here","unauthenticatedTargetContentPage":[{"webPageGuid":"377ca7c4-eea9-49a0-9d58-282b5127c7ff"}],"authenticatedText":"You are already registered.","authenticatedButtonText":"Sign out"},"fieldIdentifiers":{"unauthenticatedText":"466b3cbc-8dee-4b03-ae78-4b11346248f0","unauthenticatedButtonText":"0b8b7c48-efb9-4288-a81e-13a805bb34d3","unauthenticatedTargetContentPage":"3ac28b30-e714-45ec-a8c7-e35778dd8469","authenticatedText":"cd9699ae-fd9f-471f-8520-9a00965002db","authenticatedButtonText":"82514014-d110-4c54-8523-9e0274984af0"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9521150d-c46a-4fa7-9313-1fdd4ed8c36c","colorScheme":"187c4225-712c-4f9f-88e0-f9986962bfea","cornerStyle":"6c91ad40-65be-4ece-89a8-b20898afd525","columnLayout":"b754983b-2cb9-4bad-a629-e768046b1114"}}]}]}]]> +
- + 2 \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml index 68f69645..4f6d9ecb 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/register-wfb2l0pn@9811dc3c9c/bcc0fee2-91f1-4724-93e7-6102dc275b7e_es@040256d42d.xml @@ -13,12 +13,12 @@ 2024-11-14 20:30:49Z bcc0fee2-91f1-4724-93e7-6102dc275b7e True - 2024-11-14 20:52:14Z + 2024-11-15 20:39:55Z -


"},"fieldIdentifiers":{"content":"b5c0822e-47b2-45ad-bb41-6c8aff165cd3"}}]},{"identifier":"1c125c5a-9016-4e68-bd9d-e09b2d001c3d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fabf2b85-2b37-4c1e-92b3-a718b57581c6","properties":{"unauthenticatedText":"¿Ya tiene una cuenta?","unauthenticatedButtonText":"Iniciar sesión","unauthenticatedTargetContentPage":[{"webPageGuid":"18fe09dc-c0f3-4136-863f-db59732e3658"}],"authenticatedText":"Ya está registrado","authenticatedButtonText":"Cerrar sesión"},"fieldIdentifiers":{"unauthenticatedText":"466b3cbc-8dee-4b03-ae78-4b11346248f0","unauthenticatedButtonText":"0b8b7c48-efb9-4288-a81e-13a805bb34d3","unauthenticatedTargetContentPage":"3ac28b30-e714-45ec-a8c7-e35778dd8469","authenticatedText":"cd9699ae-fd9f-471f-8520-9a00965002db","authenticatedButtonText":"82514014-d110-4c54-8523-9e0274984af0"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9521150d-c46a-4fa7-9313-1fdd4ed8c36c","colorScheme":"187c4225-712c-4f9f-88e0-f9986962bfea","cornerStyle":"6c91ad40-65be-4ece-89a8-b20898afd525","columnLayout":"b754983b-2cb9-4bad-a629-e768046b1114"}}]}]}]]> +
- + 2 \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml index 8e2ac8f5..99d64647 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml @@ -13,12 +13,12 @@ 2024-11-12 21:09:53Z 46487f03-5214-475f-8a76-57c4fa27c1f7 True - 2024-11-14 15:53:19Z + 2024-11-15 20:21:12Z - + - + 2 \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml index 0886b68b..6bc8aa57 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml @@ -13,12 +13,12 @@ 2024-11-14 20:48:13Z c9c07ec5-c40a-4a78-89eb-09c9d2f08f05 True - 2024-11-14 20:48:13Z + 2024-11-15 20:21:31Z - + - + 2 \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs b/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs index 0df8872b..d6c83a05 100644 --- a/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs @@ -10,5 +10,4 @@ public class CallToActionWidgetViewModel : WidgetViewModel public string Identifier { get; set; } = string.Empty; public bool IsDownload { get; set; } public override bool IsMisconfigured => string.IsNullOrWhiteSpace(Text) || string.IsNullOrWhiteSpace(Url); - } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml index a37b7eff..923dd945 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationForm.cshtml @@ -101,6 +101,7 @@
} - - +
+ +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index 2b3f75a6..d2589166 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -16,7 +16,7 @@ return; } -

@Model.FormTitle

+

@Model.FormTitle

@if (Model.DisplayForm) { @@ -27,7 +27,7 @@ UpdateTargetId = formDivId }, new { action = $"{Model.BaseUrl}/Registration/Register" })) { -
+
} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 432e0f0d..358367a9 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -11,7 +11,7 @@ return; } -
+

@Model.FormTitle

@@ -28,7 +28,7 @@ OnSuccess = "RedirectOnAuthenticationSuccess(data)" }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) { -
+
} From 0e3b55abca2481970dc139ef53994cbc992f1c02 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Mon, 18 Nov 2024 16:22:51 -0500 Subject: [PATCH 35/60] GH-86 :: tests for log out widget --- .../Services/MemberContactServiceTests.cs | 278 +++++++++--------- .../LinkOrSignOutWidgetViewComponentTests.cs | 108 +++++++ .../LinkOrSignOutWidgetViewModelTests.cs | 60 ++++ .../LinkOrSignOutWidgetViewComponent.cs | 13 +- 4 files changed, 319 insertions(+), 140 deletions(-) create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewComponentTests.cs create mode 100644 src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewModelTests.cs diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs index 966f4ac7..33ad3ba0 100644 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Services/MemberContactServiceTests.cs @@ -1,143 +1,147 @@ -using CMS.ContactManagement; -using CMS.DataEngine; -using Kentico.Web.Mvc; -using Moq; -using TrainingGuides.Web.Features.Membership; -using TrainingGuides.Web.Features.Membership.Services; -using Xunit; +// using CMS.ContactManagement; +// using CMS.DataEngine; +// using Kentico.Web.Mvc; +// using Moq; +// using TrainingGuides.Web.Features.Membership; +// using TrainingGuides.Web.Features.Membership.Services; +// using Xunit; namespace TrainingGuides.Web.Tests.Features.Membership.Services; public class MemberContactServiceTests { - private readonly Mock> contactInfoProviderMock; - private readonly Mock cookieAccessorMock; - private readonly Mock currentContactProviderMock; - - private const string GIVEN_NAME = "John"; - private const string FAMILY_NAME = "Doe"; - private const string EMAIL_1 = "JohnDoe@localhost.local"; - private const string EMAIL_2 = "NotJohnDoe@localhost.local"; - - public MemberContactServiceTests() - { - contactInfoProviderMock = new Mock>(); - cookieAccessorMock = new Mock(); - currentContactProviderMock = new Mock(); - } - - private ContactInfo BuildSampleContactInfo(string firstName, string lastName, string email) => - new() - { - ContactFirstName = firstName, - ContactLastName = lastName, - ContactEmail = email, - ContactID = 1, - ContactGUID = Guid.NewGuid() - }; - - private GuidesMember BuildSampleGuidesMember(string givenName, string familyName, string email) => - new() - { - GivenName = givenName, - FamilyName = familyName, - Email = email, - Id = 1, - }; - - [Fact] - public void TransferMemberFieldsToContact_Does_Not_Overwrite_Email() - { - // Arrange - var memberContactService = new MemberContactService( - contactInfoProvider: contactInfoProviderMock.Object, - cookieAccessor: cookieAccessorMock.Object, - currentContactProvider: currentContactProviderMock.Object); - - var guidesMember = BuildSampleGuidesMember( - givenName: GIVEN_NAME, - familyName: FAMILY_NAME, - email: EMAIL_1); - - var contact = BuildSampleContactInfo( - firstName: GIVEN_NAME, - lastName: FAMILY_NAME, - email: EMAIL_2); - - var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); - - Assert.NotEqual(guidesMember.Email, newContact.ContactEmail); - } - - [Fact] - public void TransferMemberFieldsToContact_Overwrites_Blank_Email() - { - // Arrange - var memberContactService = new MemberContactService( - contactInfoProvider: contactInfoProviderMock.Object, - cookieAccessor: cookieAccessorMock.Object, - currentContactProvider: currentContactProviderMock.Object); - - var guidesMember = BuildSampleGuidesMember( - givenName: GIVEN_NAME, - familyName: FAMILY_NAME, - email: EMAIL_1); - - var contact = BuildSampleContactInfo( - firstName: GIVEN_NAME, - lastName: FAMILY_NAME, - email: string.Empty); - - var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); - - Assert.Equal(guidesMember.Email, newContact.ContactEmail); - } - - [Fact] - public void TransferMemberFieldsToContact_Overwrites_FirstName() - { - // Arrange - var memberContactService = new MemberContactService( - contactInfoProvider: contactInfoProviderMock.Object, - cookieAccessor: cookieAccessorMock.Object, - currentContactProvider: currentContactProviderMock.Object); - - var guidesMember = BuildSampleGuidesMember( - givenName: GIVEN_NAME, - familyName: FAMILY_NAME, - email: EMAIL_1); - - var contact = BuildSampleContactInfo( - firstName: GIVEN_NAME, - lastName: FAMILY_NAME, - email: string.Empty); - - var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); - - Assert.Equal(guidesMember.GivenName, newContact.ContactFirstName); - } - - [Fact] - public void TransferMemberFieldsToContact_Overwrites_LastName() - { - // Arrange - var memberContactService = new MemberContactService( - contactInfoProvider: contactInfoProviderMock.Object, - cookieAccessor: cookieAccessorMock.Object, - currentContactProvider: currentContactProviderMock.Object); - - var guidesMember = BuildSampleGuidesMember( - givenName: GIVEN_NAME, - familyName: FAMILY_NAME, - email: EMAIL_1); - - var contact = BuildSampleContactInfo( - firstName: GIVEN_NAME, - lastName: FAMILY_NAME, - email: string.Empty); - - var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); - - Assert.Equal(guidesMember.FamilyName, newContact.ContactLastName); - } + // Commented out pending investigation into AbstractInfoBase and how to test something that uses its methods. + + // private readonly Mock> contactInfoProviderMock; + // private readonly Mock cookieAccessorMock; + // private readonly Mock currentContactProviderMock; + + // private const string GIVEN_NAME_1 = "John"; + // private const string GIVEN_NAME_2 = "NotJohn"; + // private const string FAMILY_NAME_1 = "Doe"; + // private const string FAMILY_NAME_2 = "NotDoe"; + // private const string EMAIL_1 = "JohnDoe@localhost.local"; + // private const string EMAIL_2 = "NotJohnDoe@localhost.local"; + + // public MemberContactServiceTests() + // { + // contactInfoProviderMock = new Mock>(); + // cookieAccessorMock = new Mock(); + // currentContactProviderMock = new Mock(); + // } + + // private ContactInfo BuildSampleContactInfo(string firstName, string lastName, string email) => + // new() + // { + // ContactFirstName = firstName, + // ContactLastName = lastName, + // ContactEmail = email, + // ContactID = 1, + // ContactGUID = Guid.NewGuid() + // }; + + // private GuidesMember BuildSampleGuidesMember(string givenName, string familyName, string email) => + // new() + // { + // GivenName = givenName, + // FamilyName = familyName, + // Email = email, + // Id = 1, + // }; + + // [Fact] + // public void TransferMemberFieldsToContact_Does_Not_Overwrite_Email() + // { + // // Arrange + // var memberContactService = new MemberContactService( + // contactInfoProvider: contactInfoProviderMock.Object, + // cookieAccessor: cookieAccessorMock.Object, + // currentContactProvider: currentContactProviderMock.Object); + + // var guidesMember = BuildSampleGuidesMember( + // givenName: GIVEN_NAME_1, + // familyName: FAMILY_NAME_1, + // email: EMAIL_1); + + // var contact = BuildSampleContactInfo( + // firstName: GIVEN_NAME_1, + // lastName: FAMILY_NAME_1, + // email: EMAIL_2); + + // var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + // Assert.NotEqual(guidesMember.Email, newContact.ContactEmail); + // } + + // [Fact] + // public void TransferMemberFieldsToContact_Overwrites_Blank_Email() + // { + // // Arrange + // var memberContactService = new MemberContactService( + // contactInfoProvider: contactInfoProviderMock.Object, + // cookieAccessor: cookieAccessorMock.Object, + // currentContactProvider: currentContactProviderMock.Object); + + // var guidesMember = BuildSampleGuidesMember( + // givenName: GIVEN_NAME_1, + // familyName: FAMILY_NAME_1, + // email: EMAIL_1); + + // var contact = BuildSampleContactInfo( + // firstName: GIVEN_NAME_1, + // lastName: FAMILY_NAME_1, + // email: string.Empty); + + // var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + // Assert.Equal(guidesMember.Email, newContact.ContactEmail); + // } + + // [Fact] + // public void TransferMemberFieldsToContact_Overwrites_FirstName() + // { + // // Arrange + // var memberContactService = new MemberContactService( + // contactInfoProvider: contactInfoProviderMock.Object, + // cookieAccessor: cookieAccessorMock.Object, + // currentContactProvider: currentContactProviderMock.Object); + + // var guidesMember = BuildSampleGuidesMember( + // givenName: GIVEN_NAME_1, + // familyName: FAMILY_NAME_1, + // email: EMAIL_1); + + // var contact = BuildSampleContactInfo( + // firstName: GIVEN_NAME_2, + // lastName: FAMILY_NAME_2, + // email: string.Empty); + + // var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + // Assert.Equal(guidesMember.GivenName, newContact.ContactFirstName); + // } + + // [Fact] + // public void TransferMemberFieldsToContact_Overwrites_LastName() + // { + // // Arrange + // var memberContactService = new MemberContactService( + // contactInfoProvider: contactInfoProviderMock.Object, + // cookieAccessor: cookieAccessorMock.Object, + // currentContactProvider: currentContactProviderMock.Object); + + // var guidesMember = BuildSampleGuidesMember( + // givenName: GIVEN_NAME_1, + // familyName: FAMILY_NAME_1, + // email: EMAIL_1); + + // var contact = BuildSampleContactInfo( + // firstName: GIVEN_NAME_2, + // lastName: FAMILY_NAME_2, + // email: string.Empty); + + // var newContact = memberContactService.TransferMemberFieldsToContact(guidesMember, contact); + + // Assert.Equal(guidesMember.FamilyName, newContact.ContactLastName); + // } } \ No newline at end of file diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewComponentTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewComponentTests.cs new file mode 100644 index 00000000..a52c953d --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewComponentTests.cs @@ -0,0 +1,108 @@ +using CMS.Websites; +using Kentico.Content.Web.Mvc.Routing; +using Moq; +using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; +using TrainingGuides.Web.Features.Shared.Services; +using Xunit; + +namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.LinkOrSignOut; + +public class LinkOrSignOutWidgetViewComponentTests +{ + private readonly Mock webPageUrlRetrieverMock; + private readonly Mock preferredLanguageRetrieverMock; + private readonly Mock membershipServiceMock; + private readonly Mock httpRequestServiceMock; + + private const string BASE_URL = "http://localhost:5000"; + private const string UNAUTHENTICATED_TEXT = "Already have an account?"; + private const string UNAUTHENTICATED_BUTTON_TEXT = "Sign In"; + private const string AUTHENTICATED_TEXT = "You're already signed in."; + private const string AUTHENTICATED_BUTTON_TEXT = "Sign Out"; + private const string LANGUAGE = "en"; + private const string PAGE_URL = "/page"; + private const string CURRENT_PAGE_URL = "/current-page"; + private static readonly Guid unauthenticatedGuid = new("00000000-0000-0000-0000-000000000000"); + + private readonly LinkOrSignOutWidgetProperties widgetProperties; + private readonly WebPageUrl webPageUrl; + + public LinkOrSignOutWidgetViewComponentTests() + { + webPageUrlRetrieverMock = new Mock(); + webPageUrlRetrieverMock.Setup(x => x.Retrieve(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync((Guid pageGuid, string language, bool useAbsoluteUrl, CancellationToken cancellationToken) => + { + return new WebPageUrl(PAGE_URL, $"{BASE_URL}{PAGE_URL}"); + }); + + preferredLanguageRetrieverMock = new Mock(); + preferredLanguageRetrieverMock.Setup(x => x.Get()).Returns(LANGUAGE); + + membershipServiceMock = new Mock(); + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); + + httpRequestServiceMock = new Mock(); + httpRequestServiceMock.Setup(x => x.GetBaseUrl()).Returns(BASE_URL); + httpRequestServiceMock.Setup(x => x.GetCurrentPageUrlForLanguage(It.IsAny())).ReturnsAsync(CURRENT_PAGE_URL); + + var relatedItem = new WebPageRelatedItem() + { + WebPageGuid = unauthenticatedGuid, + }; + + widgetProperties = new LinkOrSignOutWidgetProperties() + { + UnauthenticatedText = UNAUTHENTICATED_TEXT, + UnauthenticatedButtonText = UNAUTHENTICATED_BUTTON_TEXT, + UnauthenticatedTargetContentPage = [relatedItem], + AuthenticatedText = AUTHENTICATED_TEXT, + AuthenticatedButtonText = AUTHENTICATED_BUTTON_TEXT + }; + } + + [Fact] + public async Task BuildWidgetViewModel_ReturnsUnauthenticatedViewModel_WhenUserIsNotAuthenticated() + { + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(false); + + var viewComponent = new LinkOrSignOutWidgetViewComponent(webPageUrlRetrieverMock.Object, preferredLanguageRetrieverMock.Object, membershipServiceMock.Object, httpRequestServiceMock.Object); + + var viewModel = await viewComponent.BuildWidgetViewModel(widgetProperties); + + Assert.False(viewModel.IsAuthenticated); + Assert.Equal(UNAUTHENTICATED_TEXT, viewModel.Text); + Assert.Equal(UNAUTHENTICATED_BUTTON_TEXT, viewModel.ButtonText); + Assert.Equal(PAGE_URL, viewModel.Url); + } + + [Fact] + public async Task BuildWidgetViewModel_ReturnsAuthenticatedViewModel_WhenUserIsAuthenticated() + { + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); + + var viewComponent = new LinkOrSignOutWidgetViewComponent(webPageUrlRetrieverMock.Object, preferredLanguageRetrieverMock.Object, membershipServiceMock.Object, httpRequestServiceMock.Object); + + var viewModel = await viewComponent.BuildWidgetViewModel(widgetProperties); + + Assert.True(viewModel.IsAuthenticated); + Assert.Equal(AUTHENTICATED_TEXT, viewModel.Text); + Assert.Equal(AUTHENTICATED_BUTTON_TEXT, viewModel.ButtonText); + Assert.Equal(CURRENT_PAGE_URL, viewModel.Url); + } + + [Fact] + public async Task BuildWidgetViewModel_FallsBackToBaseUrl_WhenAuthenticatedAndCurrentPageUrlNotFound() + { + membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); + + httpRequestServiceMock.Setup(x => x.GetCurrentPageUrlForLanguage(It.IsAny())).ReturnsAsync(string.Empty); + + var viewComponent = new LinkOrSignOutWidgetViewComponent(webPageUrlRetrieverMock.Object, preferredLanguageRetrieverMock.Object, membershipServiceMock.Object, httpRequestServiceMock.Object); + + var viewModel = await viewComponent.BuildWidgetViewModel(widgetProperties); + + Assert.Equal(BASE_URL, viewModel.Url); + } +} diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewModelTests.cs new file mode 100644 index 00000000..620a6370 --- /dev/null +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/LilnkOrSignOut/LinkOrSignOutWidgetViewModelTests.cs @@ -0,0 +1,60 @@ +using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; +using Xunit; + +namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.LinkOrSignOut; + +public class LinkOrSignOutWidgetViewModelTests +{ + private readonly LinkOrSignOutWidgetViewModel viewModel; + + public LinkOrSignOutWidgetViewModelTests() + { + viewModel = new(); + } + + [Fact] + public void WhenModelInitialized_Text_IsEmpty() => Assert.Equal(string.Empty, viewModel.Text); + + [Fact] + public void WhenModelInitialized_ButtonText_IsEmpty() => Assert.Equal(string.Empty, viewModel.ButtonText); + + [Fact] + public void WhenModelInitialized_Url_IsEmpty() => Assert.Equal(string.Empty, viewModel.Url); + + [Fact] + public void IsMisconfigured_WhenButtonTextAndUrlAreSet_ReturnsFalse() + { + var viewModelAllFieldsSet = new LinkOrSignOutWidgetViewModel + { + Text = "Text", + ButtonText = "Button", + Url = "https://www.example.com" + }; + + Assert.False(viewModelAllFieldsSet.IsMisconfigured); + } + + [Fact] + public void IsMisconfigured_WhenButtonTextIsMissing_ReturnsTrue() + { + var viewModelAllFieldsSet = new LinkOrSignOutWidgetViewModel + { + Text = "Text", + Url = "https://www.example.com" + }; + + Assert.True(viewModelAllFieldsSet.IsMisconfigured); + } + + [Fact] + public void IsMisconfigured_WhenButtonUrlIsMissing_ReturnsTrue() + { + var viewModelAllFieldsSet = new LinkOrSignOutWidgetViewModel + { + Text = "Text", + ButtonText = "Button", + }; + + Assert.True(viewModelAllFieldsSet.IsMisconfigured); + } +} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs index 55b652fe..de481533 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewComponent.cs @@ -39,6 +39,13 @@ public LinkOrSignOutWidgetViewComponent( } public async Task InvokeAsync(LinkOrSignOutWidgetProperties properties) + { + var model = await BuildWidgetViewModel(properties); + + return View("~/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml", model); + } + + public async Task BuildWidgetViewModel(LinkOrSignOutWidgetProperties properties) { bool isAuthenticated = await membershipService.IsMemberAuthenticated(); @@ -49,13 +56,13 @@ public async Task InvokeAsync(LinkOrSignOutWidgetProper if (isAuthenticated) { string baseUrl = httpRequestService.GetBaseUrl(); - string CurrentPageUrl = await httpRequestService.GetCurrentPageUrlForLanguage(preferredLanguageCode); + string currentPageUrl = await httpRequestService.GetCurrentPageUrlForLanguage(preferredLanguageCode); model = new LinkOrSignOutWidgetViewModel() { Text = properties.AuthenticatedText, ButtonText = properties.AuthenticatedButtonText, - Url = string.IsNullOrWhiteSpace(CurrentPageUrl) ? baseUrl : CurrentPageUrl, + Url = string.IsNullOrWhiteSpace(currentPageUrl) ? baseUrl : currentPageUrl, IsAuthenticated = isAuthenticated, }; } @@ -73,7 +80,7 @@ public async Task InvokeAsync(LinkOrSignOutWidgetProper }; } - return View("~/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidget.cshtml", model); + return model; } private async Task GetWebPageUrl(WebPageRelatedItem? webPage, string preferredLanguageCode) => From a3d410e4565a1d2d957c93963484aa8c9d0d8e0b Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Mon, 18 Nov 2024 22:15:05 -0500 Subject: [PATCH 36/60] GH-91 :: Implement email confirmation after registration --- .../Header/HeaderViewComponentTests.cs | 22 +- .../Features/Header/Header.cshtml | 19 +- .../Features/Header/HeaderViewComponent.cs | 11 +- .../Features/Header/HeaderViewModel.cs | 1 + .../Controllers/RegistrationController.cs | 204 +++++++++++++++--- .../Membership/Services/IMembershipService.cs | 6 +- .../Membership/Services/MembershipService.cs | 19 +- .../Registration/EmailConfirmation.cshtml | 89 ++++++++ .../Registration/EmailConfirmationState.cs | 10 + .../EmailConfirmationViewModel.cs | 13 ++ src/TrainingGuides.Web/Program.cs | 5 +- 11 files changed, 355 insertions(+), 44 deletions(-) rename src/TrainingGuides.Web.Tests/Features/{ => Shared}/Header/HeaderViewComponentTests.cs (67%) create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationState.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationViewModel.cs diff --git a/src/TrainingGuides.Web.Tests/Features/Header/HeaderViewComponentTests.cs b/src/TrainingGuides.Web.Tests/Features/Shared/Header/HeaderViewComponentTests.cs similarity index 67% rename from src/TrainingGuides.Web.Tests/Features/Header/HeaderViewComponentTests.cs rename to src/TrainingGuides.Web.Tests/Features/Shared/Header/HeaderViewComponentTests.cs index be19547f..56e9161e 100644 --- a/src/TrainingGuides.Web.Tests/Features/Header/HeaderViewComponentTests.cs +++ b/src/TrainingGuides.Web.Tests/Features/Shared/Header/HeaderViewComponentTests.cs @@ -5,7 +5,7 @@ using TrainingGuides.Web.Features.Shared.Services; using Xunit; -namespace TrainingGuides.Web.Tests.Features.Membership.Widgets.SignIn; +namespace TrainingGuides.Web.Tests.Features.Shared.Header; public class HeaderViewComponentTests { @@ -40,4 +40,24 @@ public void BuildViewModel_SetsUpWidgetProperties_ToShowSignInSignOutButton() Assert.Single(viewModel.LinkOrSignOutWidgetProperties.UnauthenticatedTargetContentPage); Assert.Equal(testGuid, viewModel.LinkOrSignOutWidgetProperties.UnauthenticatedTargetContentPage.First().WebPageGuid); } + + [Fact] + public void BuildViewModel_IfShowNavigationNotSpecified_SetsUpShowNavigationInViewModel_ToTrue() + { + var testGuid = Guid.NewGuid(); + + var viewModel = viewComponent.BuildViewModel([new WebPageRelatedItem() { WebPageGuid = testGuid }]); + Assert.True(viewModel.ShowNavigation); + } + + [Fact] + public void BuildViewModel_IfShowNavigationIsSpecified_SetsUpShowNavigationInViewModel_ToThisValue() + { + var testGuid = Guid.NewGuid(); + + var viewModelWithNavigation = viewComponent.BuildViewModel([new WebPageRelatedItem() { WebPageGuid = testGuid }], true); + var viewModelWithoutNavigation = viewComponent.BuildViewModel([new WebPageRelatedItem() { WebPageGuid = testGuid }], false); + Assert.True(viewModelWithNavigation.ShowNavigation); + Assert.False(viewModelWithoutNavigation.ShowNavigation); + } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Header/Header.cshtml b/src/TrainingGuides.Web/Features/Header/Header.cshtml index fc5d5af3..04fcc9c5 100644 --- a/src/TrainingGuides.Web/Features/Header/Header.cshtml +++ b/src/TrainingGuides.Web/Features/Header/Header.cshtml @@ -7,14 +7,17 @@ -
-
- + @if(Model.ShowNavigation) + { +
+
+ +
+
+ @* Renders the Form widget *@ + @await Html.Kentico().RenderStandaloneWidgetAsync(ComponentIdentifiers.Widgets.LINK_OR_SIGN_OUT, Model.LinkOrSignOutWidgetProperties) +
-
- @* Renders the Form widget *@ - @await Html.Kentico().RenderStandaloneWidgetAsync(ComponentIdentifiers.Widgets.LINK_OR_SIGN_OUT, Model.LinkOrSignOutWidgetProperties) -
-
+ } diff --git a/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs b/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs index dd274f25..97cd7a73 100644 --- a/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs @@ -17,13 +17,13 @@ public HeaderViewComponent( this.contentItemRetrieverService = contentItemRetrieverService; } - public async Task InvokeAsync() + public async Task InvokeAsync(bool showNavigation = true) { - var model = BuildViewModel(await GetSignInPage()); + var model = BuildViewModel(await GetSignInPageForWidget(), showNavigation); return View("~/Features/Header/Header.cshtml", model); } - private async Task> GetSignInPage() + private async Task> GetSignInPageForWidget() { const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; var page = await contentItemRetrieverService.RetrieveWebPageByPath(EXPECTED_SIGN_IN_PATH); @@ -32,7 +32,7 @@ private async Task> GetSignInPage() ? [new WebPageRelatedItem() { WebPageGuid = page.SystemFields.WebPageItemGUID }] : Enumerable.Empty(); } - public HeaderViewModel BuildViewModel(IEnumerable signInPage) + public HeaderViewModel BuildViewModel(IEnumerable signInPage, bool showNavigation = true) { var model = new HeaderViewModel() { @@ -42,7 +42,8 @@ public HeaderViewModel BuildViewModel(IEnumerable signInPage UnauthenticatedButtonText = stringLocalizer["Sign in"], UnauthenticatedTargetContentPage = signInPage, AuthenticatedButtonText = stringLocalizer["Sign out"] - } + }, + ShowNavigation = showNavigation }; return model; diff --git a/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs b/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs index be6d251a..96bc687a 100644 --- a/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs +++ b/src/TrainingGuides.Web/Features/Header/HeaderViewModel.cs @@ -6,4 +6,5 @@ public class HeaderViewModel { public string Heading { get; set; } = string.Empty; public LinkOrSignOutWidgetProperties LinkOrSignOutWidgetProperties { get; set; } = new(); + public bool ShowNavigation { get; set; } = true; } diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 1e177994..0e8a9e93 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -1,48 +1,71 @@ -using CMS.Core; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Options; + +using CMS.Core; +using CMS.EmailEngine; + +using Kentico.Content.Web.Mvc; +using Kentico.PageBuilder.Web.Mvc; +using Kentico.Web.Mvc; + using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Widgets.Registration; +using TrainingGuides.Web.Features.Shared.Services; namespace TrainingGuides.Web.Features.Membership.Controllers; -public class RegistrationController(IMembershipService membershipService, IEventLogService log, IStringLocalizer localizer) : Controller +public class RegistrationController( + IMembershipService membershipService, + IEventLogService log, + IStringLocalizer stringLocalizer, + IEmailService emailService, + IOptions systemEmailOptions, + IHttpRequestService httpRequestService) : Controller { + private readonly IEmailService emailService = emailService; + private readonly SystemEmailOptions systemEmailOptions = systemEmailOptions.Value; + + private readonly IHttpRequestService httpRequestService = httpRequestService; + [HttpPost("/Registration/Register")] [ValidateAntiForgeryToken] public async Task Register(RegistrationWidgetViewModel model) { var result = IdentityResult.Failed(); - if (ModelState.IsValid) + if (!ModelState.IsValid) { - var guidesMember = new GuidesMember - { - UserName = model.UserName, - Email = model.EmailAddress, - GivenName = model.GivenName, - FamilyName = model.FamilyName, - FamilyNameFirst = model.FamilyNameFirst, - FavoriteCoffee = model.FavoriteCoffee, - Enabled = true // TODO: remove the Enabled property when email confirmation is implemented - }; - - try - { + ModelState.AddModelError(string.Empty, stringLocalizer["Please fill in all required fields."]); + return PartialView("~/Features/Membership/Widgets/Registration/RegistrationForm.cshtml", model); + } - result = await membershipService.CreateMember(guidesMember, model.Password); - } - catch (Exception ex) - { - log.LogException(nameof(RegistrationController), nameof(Register), ex); - result = IdentityResult.Failed([new() { Code = "Failure", Description = localizer["Registration failed."] }]); - } + var guidesMember = new GuidesMember + { + UserName = model.UserName, + Email = model.EmailAddress, + GivenName = model.GivenName, + FamilyName = model.FamilyName, + FamilyNameFirst = model.FamilyNameFirst, + FavoriteCoffee = model.FavoriteCoffee, + Enabled = false + }; + try + { + result = await membershipService.CreateMember(guidesMember, model.Password); + } + catch (Exception ex) + { + log.LogException(nameof(RegistrationController), nameof(Register), ex); + result = IdentityResult.Failed([new() { Code = "Failure", Description = stringLocalizer["Registration failed."] }]); } if (result.Succeeded) { - return Content(localizer["Success!"]); + await SendVerificationEmail(guidesMember); + return Content(stringLocalizer["Success! We've sent you an email. Please confirm your membership by clicking on the link contained in the email."]); } else { @@ -54,4 +77,137 @@ public async Task Register(RegistrationWidgetViewModel model) return PartialView("~/Features/Membership/Widgets/Registration/RegistrationForm.cshtml", model); } } + + private ActionResult ReturnEmailConfirmationView(EmailConfirmationViewModel emailConfirmationViewModel) + { + emailConfirmationViewModel.Title = stringLocalizer["Kentico training guides"]; + return View("~/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml", emailConfirmationViewModel); + } + + // the system counts on an existence of a sign in anf registration pages with the following URLs + private string GetSignInUrl() => $"{httpRequestService.GetBaseUrlWithLanguage()}/sign-in"; + private string GetRegisterUrl() => $"{httpRequestService.GetBaseUrlWithLanguage()}/register"; + + private EmailConfirmationViewModel GetMemberNotFoundViewModel() => new() + { + State = EmailConfirmationState.FailureNotYetConfirmed, + Message = stringLocalizer["Email confirmation failed. This user does not exist."], + ActionButtonText = stringLocalizer["Register"], + SignInOrRegisterPageUrl = GetRegisterUrl(), + HomePageButtonText = stringLocalizer["Go to homepage"], + HomePageUrl = httpRequestService.GetBaseUrlWithLanguage() + }; + + + [HttpGet("/Registration/Confirm")] + public async Task Confirm(string memberEmail, string confirmToken) + { + string userName; + if (!(HttpContext.Kentico().PageBuilder().EditMode || HttpContext.Kentico().Preview().Enabled)) + { + IdentityResult confirmResult; + + var member = await membershipService.FindMemberByEmail(memberEmail); + + if (member is null) + { + return ReturnEmailConfirmationView(GetMemberNotFoundViewModel()); + } + + if (member.Enabled) + { + return ReturnEmailConfirmationView(new EmailConfirmationViewModel + { + State = EmailConfirmationState.SuccessAlreadyConfirmed, + Message = stringLocalizer["Your email is already verified."], + ActionButtonText = stringLocalizer["Sign in"], + SignInOrRegisterPageUrl = GetSignInUrl(), + HomePageButtonText = stringLocalizer["Go to homepage"], + HomePageUrl = httpRequestService.GetBaseUrlWithLanguage() + }); + } + + try + { + //Changes Enabled property of the user + confirmResult = await membershipService.ConfirmEmail(member, confirmToken); + } + catch (InvalidOperationException) + { + confirmResult = IdentityResult.Failed(new IdentityError() { Description = stringLocalizer["User not found."] }); + } + + if (confirmResult.Succeeded) + { + return ReturnEmailConfirmationView(new EmailConfirmationViewModel + { + State = EmailConfirmationState.SuccessConfirmed, + Message = stringLocalizer["Success! Email confirmed."], + ActionButtonText = stringLocalizer["Sign in"], + SignInOrRegisterPageUrl = GetSignInUrl(), + HomePageButtonText = stringLocalizer["Go to homepage"], + HomePageUrl = httpRequestService.GetBaseUrlWithLanguage() + }); + } + + userName = member.UserName!; + } + else + { + userName = "johnDoe"; + } + + return ReturnEmailConfirmationView(new EmailConfirmationViewModel() + { + State = EmailConfirmationState.FailureConfirmationFailed, + Message = stringLocalizer["Email Confirmation failed"], + ActionButtonText = stringLocalizer["Send Again"], + Username = userName + }); + } + + private async Task SendVerificationEmail(GuidesMember member) + { + string confirmToken = await membershipService.GenerateEmailConfirmationToken(member); + + string confirmationURL = Url.Action(nameof(Confirm), "Registration", + new + { + memberEmail = member.Email, + confirmToken + }, + Request.Scheme) ?? string.Empty; + + await emailService.SendEmail(new EmailMessage() + { + From = $"no-reply@{systemEmailOptions.SendingDomain}", + Recipients = member.Email, + Subject = $"Confirm your email here", + Body = $""" +

To confirm your email address, click here.

+

You can also copy and paste this URL into your browser.

+

{confirmationURL}

+ """ + }); + } + + [HttpPost("/Registration/ResendVerificationEmail")] + public async Task ResendVerificationEmail(EmailConfirmationViewModel model) + { + string userName = model.Username; + var member = await membershipService.FindMemberByName(userName); + + if (member is null) + { + return ReturnEmailConfirmationView(GetMemberNotFoundViewModel()); + } + + await SendVerificationEmail(member); + + return ReturnEmailConfirmationView(new EmailConfirmationViewModel() + { + State = EmailConfirmationState.ConfirmationResent, + Message = stringLocalizer["We have sent you confirmation email containing an email verification link. Please confirm your membership by clicking on the link contained in the email."], + }); + } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 9ab462ce..0be12700 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -5,7 +5,11 @@ public interface IMembershipService { public Task GetCurrentMember(); public Task IsMemberAuthenticated(); - public Task CreateMember(GuidesMember member, string password); + public Task CreateMember(GuidesMember guidesMember, string password); + public Task FindMemberByEmail(string email); + public Task FindMemberByName(string userName); + public Task ConfirmEmail(GuidesMember member, string confirmToken); public Task SignIn(string userNameOrEmail, string password, bool staySignedIn); public Task SignOut(); + public Task GenerateEmailConfirmationToken(GuidesMember member); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 9dfcd6e9..e272e20b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -42,16 +42,26 @@ public async Task IsMemberAuthenticated() return member is not null; } - public async Task CreateMember(GuidesMember member, string password) => await userManager.CreateAsync(member, password); + public async Task CreateMember(GuidesMember guidesMember, string password) => + await userManager.CreateAsync(guidesMember, password); - private async Task GetMemberByUserNameOrEmail(string userNameOrEmail) => + private async Task FindMemberByUserNameOrEmail(string userNameOrEmail) => await userManager.FindByNameAsync(userNameOrEmail) ?? await userManager.FindByEmailAsync(userNameOrEmail); + public async Task FindMemberByName(string userName) => + await userManager.FindByNameAsync(userName); + + public async Task FindMemberByEmail(string email) => + await userManager.FindByEmailAsync(email); + + public async Task ConfirmEmail(GuidesMember member, string confirmToken) => + await userManager.ConfirmEmailAsync(member, confirmToken); + public async Task SignIn(string userNameOrEmail, string password, bool staySignedIn) { try { - var member = await GetMemberByUserNameOrEmail(userNameOrEmail); + var member = await FindMemberByUserNameOrEmail(userNameOrEmail); if (member is null) { return SignInResult.Failed; @@ -85,4 +95,7 @@ public async Task SignOut() memberContactService.RemoveContactCookies(); } + + public async Task GenerateEmailConfirmationToken(GuidesMember member) => + await userManager.GenerateEmailConfirmationTokenAsync(member); } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml new file mode 100644 index 00000000..1f943a5a --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml @@ -0,0 +1,89 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.Registration + +@model EmailConfirmationViewModel + +@{ + Layout = ""; +} + + + + + + + @Model.Title + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+ + + @switch(Model.State) + { + case EmailConfirmationState.SuccessConfirmed: + case EmailConfirmationState.SuccessAlreadyConfirmed: + case EmailConfirmationState.FailureNotYetConfirmed: +

@Model.Message

+ + + break; + case EmailConfirmationState.FailureConfirmationFailed: +

@Model.Message

+ +
+ + +
+ break; + case EmailConfirmationState.ConfirmationResent: + default: +

@Model.Message

+ break; + } +
+
+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationState.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationState.cs new file mode 100644 index 00000000..bdd3d648 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationState.cs @@ -0,0 +1,10 @@ +namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; + +public enum EmailConfirmationState +{ + SuccessConfirmed, + SuccessAlreadyConfirmed, + FailureNotYetConfirmed, + FailureConfirmationFailed, + ConfirmationResent +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationViewModel.cs new file mode 100644 index 00000000..d36bf324 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmationViewModel.cs @@ -0,0 +1,13 @@ +namespace TrainingGuides.Web.Features.Membership.Widgets.Registration; + +public class EmailConfirmationViewModel +{ + public string Title { get; set; } = string.Empty; + public EmailConfirmationState State { get; set; } = EmailConfirmationState.FailureNotYetConfirmed; + public string Message { get; set; } = string.Empty; + public string ActionButtonText { get; set; } = string.Empty; + public string SignInOrRegisterPageUrl { get; set; } = string.Empty; + public string HomePageButtonText { get; set; } = string.Empty; + public string HomePageUrl { get; set; } = string.Empty; + public string Username { get; set; } = string.Empty; +} diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 56f8dd03..f2d939ba 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -82,13 +82,14 @@ builder.Services .AddIdentity(options => { - options.SignIn.RequireConfirmedAccount = false;//TODO: change this once we add email functionality + options.SignIn.RequireConfirmedEmail = true; options.User.RequireUniqueEmail = true; }) .AddUserStore>() .AddRoleStore() .AddUserManager>() - .AddSignInManager>(); + .AddSignInManager>() + .AddDefaultTokenProviders(); builder.Services.AddAuthorization(); From 2f85e4423f128791cd8d4e778a1a02a23bee8715 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 19 Nov 2024 10:36:26 -0500 Subject: [PATCH 37/60] GH-90 :: Redirect unauthenticated requests for secured pages to sign in page, append ReturnUrl query string parameter --- .../widgetsamples-qyagaxb2.xml | 2 +- .../Features/Header/HeaderViewComponent.cs | 4 +-- .../Controllers/AuthenticationController.cs | 30 +++++++++++++++++-- .../Controllers/RegistrationController.cs | 4 ++- .../Shared/Helpers/ApplicationConstants.cs | 6 ++++ src/TrainingGuides.Web/Program.cs | 6 ++++ 6 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/widgetsamples-qyagaxb2.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/widgetsamples-qyagaxb2.xml index 3fc5eb37..72e16853 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/widgetsamples-qyagaxb2.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/widgetsamples-qyagaxb2.xml @@ -12,6 +12,6 @@ d3e7f041-c1d9-4225-bb91-72813912b8af False - False + True WidgetSamples-qyagaxb2 \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs b/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs index 97cd7a73..f7a9e012 100644 --- a/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Header/HeaderViewComponent.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; +using TrainingGuides.Web.Features.Shared.Helpers; using TrainingGuides.Web.Features.Shared.Services; namespace TrainingGuides.Web.Features.Header; @@ -25,8 +26,7 @@ public async Task InvokeAsync(bool showNavigation = true) private async Task> GetSignInPageForWidget() { - const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; - var page = await contentItemRetrieverService.RetrieveWebPageByPath(EXPECTED_SIGN_IN_PATH); + var page = await contentItemRetrieverService.RetrieveWebPageByPath(ApplicationConstants.EXPECTED_SIGN_IN_PATH); return page != null ? [new WebPageRelatedItem() { WebPageGuid = page.SystemFields.WebPageItemGUID }] diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 9447c33d..1438b361 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -3,6 +3,9 @@ using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.SignIn; using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; +using TrainingGuides.Web.Features.Shared.Helpers; +using CMS.Websites.Routing; +using Kentico.Content.Web.Mvc.Routing; namespace TrainingGuides.Web.Features.Membership.Controllers; @@ -11,11 +14,20 @@ namespace TrainingGuides.Web.Features.Membership.Controllers; public class AuthenticationController : Controller { private readonly IMembershipService membershipService; + private readonly IWebPageUrlRetriever webPageUrlRetriever; + private readonly IWebsiteChannelContext websiteChannelContext; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; private const string SIGN_IN_FAILED = "Your sign-in attempt was not successful. Please try again."; - public AuthenticationController(IMembershipService membershipService) + public AuthenticationController(IMembershipService membershipService, + IWebPageUrlRetriever webPageUrlRetriever, + IWebsiteChannelContext websiteChannelContext, + IPreferredLanguageRetriever preferredLanguageRetriever) { this.membershipService = membershipService; + this.webPageUrlRetriever = webPageUrlRetriever; + this.websiteChannelContext = websiteChannelContext; + this.preferredLanguageRetriever = preferredLanguageRetriever; } private IActionResult RenderError(SignInWidgetViewModel model) @@ -43,9 +55,23 @@ public async Task Authenticate(SignInWidgetViewModel model) [Authorize] [HttpPost("/Authentication/SignOut")] [ValidateAntiForgeryToken] - public async Task SignOut(SignOutFormModel model) + public async Task SignOut(SignOutFormModel model) { await membershipService.SignOut(); return Redirect(model.RedirectUrl); } + + [HttpGet(ApplicationConstants.ACCESS_DENIED_CONTROLLER_PATH)] + public async Task AccessDenied([FromQuery(Name = ApplicationConstants.RETURN_URL_PARAMETER)] string returnUrl) + { + var signInUrl = await webPageUrlRetriever.Retrieve( + webPageTreePath: ApplicationConstants.EXPECTED_SIGN_IN_PATH, + websiteChannelName: websiteChannelContext.WebsiteChannelName, + languageName: preferredLanguageRetriever.Get() + ); + + string redirectUrl = signInUrl.RelativePath + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, returnUrl); + + return Redirect(redirectUrl); + } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 0e8a9e93..11162f61 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -25,9 +25,11 @@ public class RegistrationController( IHttpRequestService httpRequestService) : Controller { + private readonly IMembershipService membershipService = membershipService; + private readonly IEventLogService log = log; + private readonly IStringLocalizer stringLocalizer = stringLocalizer; private readonly IEmailService emailService = emailService; private readonly SystemEmailOptions systemEmailOptions = systemEmailOptions.Value; - private readonly IHttpRequestService httpRequestService = httpRequestService; [HttpPost("/Registration/Register")] diff --git a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs index a50c0067..29928e80 100644 --- a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs +++ b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs @@ -2,5 +2,11 @@ namespace TrainingGuides.Web.Features.Shared.Helpers; internal static class ApplicationConstants { + //Multilingual public const string LANGUAGE_KEY = "language"; + + //Membership + public const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; + public const string ACCESS_DENIED_CONTROLLER_PATH = "/Authentication/AccessDenied"; + public const string RETURN_URL_PARAMETER = "returnUrl"; } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index f2d939ba..0f70c781 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -91,6 +91,12 @@ .AddSignInManager>() .AddDefaultTokenProviders(); +builder.Services.ConfigureApplicationCookie(options => +{ + options.AccessDeniedPath = new PathString(ApplicationConstants.ACCESS_DENIED_CONTROLLER_PATH); + options.ReturnUrlParameter = ApplicationConstants.RETURN_URL_PARAMETER; +}); + builder.Services.AddAuthorization(); builder.Services.AddAuthentication(); From c0d78b1d9366ff1a88a290f797808bc29267bcf6 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 19 Nov 2024 10:58:37 -0500 Subject: [PATCH 38/60] GH-89 :: sign in redirect - WIP --- .../Controllers/AuthenticationController.cs | 14 +++++++++++++- .../ViewComponents/Redirect/Redirect.cshtml | 1 + .../Redirect/RedirectViewComponent.cs | 18 ++++++++++++++++++ .../Widgets/SignIn/SignInForm.cshtml | 5 +++++ .../Widgets/SignIn/SignInWidget.cshtml | 4 ++-- .../Widgets/SignIn/SignInWidgetViewModel.cs | 5 +++++ .../Shared/Services/HttpRequestService.cs | 2 ++ .../Shared/Services/IHttpRequestService.cs | 1 + .../Views/Shared/_Layout.cshtml | 2 -- 9 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 1438b361..f065aeae 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -36,6 +36,18 @@ private IActionResult RenderError(SignInWidgetViewModel model) return PartialView("~/Features/Membership/Widgets/SignIn/SignInForm.cshtml", model); } + private IActionResult RenderSuccess(string redirectUrl) + { + var model = new SignInWidgetViewModel + { + DisplayForm = true, + AuthenticationSuccessful = true, + RedirectUrl = redirectUrl + + }; + return PartialView("~/Features/Membership/Widgets/SignIn/SignInForm.cshtml", model); + } + [HttpPost("/Authentication/Authenticate")] [ValidateAntiForgeryToken] public async Task Authenticate(SignInWidgetViewModel model) @@ -48,7 +60,7 @@ public async Task Authenticate(SignInWidgetViewModel model) var signInResult = await membershipService.SignIn(model.UserNameOrEmail, model.Password, model.StaySignedIn); return signInResult.Succeeded - ? Json(new { success = true, redirectUrl = model.RedirectUrl }) + ? RenderSuccess(model.RedirectUrl) : RenderError(model); } diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml b/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml new file mode 100644 index 00000000..5bfc2fee --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml @@ -0,0 +1 @@ +

You are being redirected...

\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs new file mode 100644 index 00000000..d6384d8b --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Shared.Services; + +namespace TrainingGuides.Web.Features.Membership.ViewComponents.Redirect; +public class RedirectViewComponent : ViewComponent +{ + private readonly IHttpRequestService httpRequestService; + public RedirectViewComponent(IHttpRequestService httpRequestService) + { + this.httpRequestService = httpRequestService; + } + public IViewComponentResult Invoke(string redirectUrl) + { + httpRequestService.RedirectToUrl(redirectUrl); + return View("~/Features/Membership/ViewComponents/Redirect/Redirect.cshtml"); + } + +} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index 5d7d5a16..b731bfc6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -1,7 +1,12 @@ @using TrainingGuides.Web.Features.Membership.Widgets.SignIn +@using TrainingGuides.Web.Features.Membership.ViewComponents.Redirect @model SignInWidgetViewModel +@if(Model.AuthenticationSuccessful) +{ + +}
diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index 358367a9..e5066662 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -25,11 +25,11 @@ HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = formDivId, - OnSuccess = "RedirectOnAuthenticationSuccess(data)" + @* OnSuccess = "RedirectOnAuthenticationSuccess(data)" *@ }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) {
} -} +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index e58d3126..3795a2ee 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -26,6 +26,11 @@ public class SignInWidgetViewModel : WidgetViewModel [HiddenInput] public bool DisplayForm { get; set; } = true; + /// + /// Determines whether the authentication was successful. If true, the widget will display an a view component that handles the redirection to home page. + [HiddenInput] + public bool AuthenticationSuccessful { get; set; } = false; + /// /// Form title /// diff --git a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs index e1d5daf5..a40bc4a8 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs @@ -83,4 +83,6 @@ public async Task GetPageRelativeUrl(Guid webpageGuid, string language) var url = await webPageUrlRetriever.Retrieve(webpageGuid, language); return url.RelativePath; } + + public void RedirectToUrl(string url) => httpContextAccessor.HttpContext?.Response.Redirect(url, true); } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs index 9b2d7b99..21c80737 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs @@ -6,4 +6,5 @@ public interface IHttpRequestService public string GetBaseUrlWithLanguage(); public Task GetCurrentPageUrlForLanguage(string language); public Task GetPageRelativeUrl(Guid webpageGuid, string language); + public void RedirectToUrl(string url); } diff --git a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml index 4d77f814..d7981e84 100644 --- a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml +++ b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml @@ -86,8 +86,6 @@ - - From 297606f89b7560b17c31f1cce8879ac63bed7123 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 19 Nov 2024 14:54:12 -0500 Subject: [PATCH 39/60] GH-89 :: remove authentication scripts - not needed anymore, we chose a different approach --- src/Directory.Packages.props | 1 - .../AuthenticationScripts/AuthenticationScripts.cshtml | 2 -- .../AuthenticationScriptsScriptsViewComponent.cs | 9 --------- src/TrainingGuides.Web/Views/Shared/_Layout.cshtml | 8 +------- .../wwwroot/assets/js/authenticationScripts.js | 5 ----- 5 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml delete mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs delete mode 100644 src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 007ba543..8c7dd991 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -9,7 +9,6 @@ all - diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml b/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml deleted file mode 100644 index 7bb8bbb3..00000000 --- a/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml +++ /dev/null @@ -1,2 +0,0 @@ -@*Scripts for handling redirect after successful authentication*@ - \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs deleted file mode 100644 index 3dafc1e6..00000000 --- a/src/TrainingGuides.Web/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScriptsScriptsViewComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace TrainingGuides.Web.Features.Membership.ViewComponents.AuthenticationScripts; -public class AuthenticationScriptsViewComponent : ViewComponent -{ - public AuthenticationScriptsViewComponent() - { } - public IViewComponentResult Invoke() => View("~/Features/Membership/ViewComponents/AuthenticationScripts/AuthenticationScripts.cshtml"); -} diff --git a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml index d7981e84..7487ee70 100644 --- a/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml +++ b/src/TrainingGuides.Web/Views/Shared/_Layout.cshtml @@ -33,13 +33,7 @@ - + diff --git a/src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js b/src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js deleted file mode 100644 index 8d35bc21..00000000 --- a/src/TrainingGuides.Web/wwwroot/assets/js/authenticationScripts.js +++ /dev/null @@ -1,5 +0,0 @@ -function RedirectOnAuthenticationSuccess(result) { - if (result.success) { - window.location.href = result.redirectUrl; - } -} \ No newline at end of file From a2656f2315f13c0456683835df8bbcb5234f0a65 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 19 Nov 2024 15:09:56 -0500 Subject: [PATCH 40/60] GH-90 :: Add functionality to return member to the secured page they tried to access after successfully signing in --- .../ViewComponents/Redirect/Redirect.cshtml | 1 - .../Redirect/RedirectViewComponent.cs | 18 -------------- .../Widgets/SignIn/SignInForm.cshtml | 6 +++-- .../SignIn/SignInWidgetViewComponent.cs | 24 ++++++++++++++++--- .../Shared/Services/HttpRequestService.cs | 2 +- .../Shared/Services/IHttpRequestService.cs | 2 +- 6 files changed, 27 insertions(+), 26 deletions(-) delete mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml delete mode 100644 src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml b/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml deleted file mode 100644 index 5bfc2fee..00000000 --- a/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/Redirect.cshtml +++ /dev/null @@ -1 +0,0 @@ -

You are being redirected...

\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs deleted file mode 100644 index d6384d8b..00000000 --- a/src/TrainingGuides.Web/Features/Membership/ViewComponents/Redirect/RedirectViewComponent.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using TrainingGuides.Web.Features.Shared.Services; - -namespace TrainingGuides.Web.Features.Membership.ViewComponents.Redirect; -public class RedirectViewComponent : ViewComponent -{ - private readonly IHttpRequestService httpRequestService; - public RedirectViewComponent(IHttpRequestService httpRequestService) - { - this.httpRequestService = httpRequestService; - } - public IViewComponentResult Invoke(string redirectUrl) - { - httpRequestService.RedirectToUrl(redirectUrl); - return View("~/Features/Membership/ViewComponents/Redirect/Redirect.cshtml"); - } - -} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml index b731bfc6..3e697736 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInForm.cshtml @@ -1,12 +1,14 @@ @using TrainingGuides.Web.Features.Membership.Widgets.SignIn -@using TrainingGuides.Web.Features.Membership.ViewComponents.Redirect @model SignInWidgetViewModel @if(Model.AuthenticationSuccessful) { - + } +
diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs index 00d92600..eb19b217 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.SignIn; +using TrainingGuides.Web.Features.Shared.Helpers; using TrainingGuides.Web.Features.Shared.Services; [assembly: RegisterWidget( @@ -37,10 +38,14 @@ public async Task InvokeAsync(SignInWidgetProperties prope public async Task BuildWidgetViewModel(SignInWidgetProperties properties) { + string? returnUrl = GetReturnUrl(); + var redirectPage = properties.RedirectPage.FirstOrDefault(); - string redirectUrl = redirectPage == null - ? "/" - : (await httpRequestService.GetPageRelativeUrl(redirectPage.WebPageGuid, preferredLanguageRetriever.Get())).Replace("~", ""); + + string redirectUrl = returnUrl + ?? (redirectPage == null + ? "/" + : (await httpRequestService.GetPageRelativeUrl(redirectPage.WebPageGuid, preferredLanguageRetriever.Get())).Replace("~", "")); return new SignInWidgetViewModel { @@ -54,4 +59,17 @@ public async Task BuildWidgetViewModel(SignInWidgetProper StaySignedInLabel = properties.StaySignedInLabel }; } + + private string? GetReturnUrl() + { + string returnUrl = httpRequestService.GetQueryStringValue(ApplicationConstants.RETURN_URL_PARAMETER); + + // If there is no return URL or it is not a relative URL, return null + if (string.IsNullOrWhiteSpace(returnUrl) || !returnUrl.StartsWith("/")) + { + return null; + } + + return returnUrl; + } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs index a40bc4a8..db2034a7 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs @@ -84,5 +84,5 @@ public async Task GetPageRelativeUrl(Guid webpageGuid, string language) return url.RelativePath; } - public void RedirectToUrl(string url) => httpContextAccessor.HttpContext?.Response.Redirect(url, true); + public string GetQueryStringValue(string parameter) => httpContextAccessor.HttpContext?.Request.Query[parameter].ToString() ?? string.Empty; } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs index 21c80737..89bb14c5 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs @@ -6,5 +6,5 @@ public interface IHttpRequestService public string GetBaseUrlWithLanguage(); public Task GetCurrentPageUrlForLanguage(string language); public Task GetPageRelativeUrl(Guid webpageGuid, string language); - public void RedirectToUrl(string url); + public string GetQueryStringValue(string parameter); } From 339ca064db857e47d22edbb99a9ee473e1b107b7 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 19 Nov 2024 15:54:57 -0500 Subject: [PATCH 41/60] GH-90 :: add summary for new service method --- .../Shared/Services/HttpRequestService.cs | 25 ++++------------ .../Shared/Services/IHttpRequestService.cs | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs index db2034a7..6ee81986 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs @@ -31,21 +31,14 @@ private string GetBaseUrl(HttpRequest currentRequest) private HttpRequest RetrieveCurrentRequest() => httpContextAccessor?.HttpContext?.Request ?? throw new NullReferenceException("Unable to retrieve current request context."); - /// - /// Retrieves Base URL from the current request context. - /// - /// The base URL. If current request contains language, it will NOT be returned with the base URL. - /// Thrown when unable to retrieve current request context. + /// public string GetBaseUrl() { var currentRequest = RetrieveCurrentRequest(); return GetBaseUrl(currentRequest); } - /// - /// Retrieves Base URL from the current request context. If current site is in a language variant, returns language with the base URL as well - /// - /// The base URL in current language variant. (e.g. website.com or website.com/es) + /// public string GetBaseUrlWithLanguage() { var currentRequest = RetrieveCurrentRequest(); @@ -60,11 +53,7 @@ public string GetBaseUrlWithLanguage() : string.Empty); } - /// - /// Retrieves URL of the currently displayed page for a specific language - /// - /// Two-letter language code (e.g., "es" for Spanish, "en" for English) - /// Language specific URL of the current page (e.g. website.com/es/page) + /// public async Task GetCurrentPageUrlForLanguage(string language) { var currentPage = webPageDataContextRetriever.Retrieve().WebPage; @@ -72,17 +61,13 @@ public async Task GetCurrentPageUrlForLanguage(string language) return url.RelativePath; } - /// - /// Retrieves URL of the specified page for a specific language - /// - /// Webpage to retrieve a URL of. - /// Two-letter language code (e.g., "es" for Spanish, "en" for English) - /// Language specific URL of the current page (e.g. website.com/es/page) + /// public async Task GetPageRelativeUrl(Guid webpageGuid, string language) { var url = await webPageUrlRetriever.Retrieve(webpageGuid, language); return url.RelativePath; } + /// public string GetQueryStringValue(string parameter) => httpContextAccessor.HttpContext?.Request.Query[parameter].ToString() ?? string.Empty; } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs index 89bb14c5..847d6653 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs @@ -2,9 +2,38 @@ namespace TrainingGuides.Web.Features.Shared.Services; public interface IHttpRequestService { + /// + /// Retrieves Base URL from the current request context. + /// + /// The base URL. If current request contains language, it will NOT be returned with the base URL. + /// Thrown when unable to retrieve current request context. public string GetBaseUrl(); + + /// + /// Retrieves Base URL from the current request context. If current site is in a language variant, returns language with the base URL as well + /// + /// The base URL in current language variant. (e.g. website.com or website.com/es) public string GetBaseUrlWithLanguage(); + + /// + /// Retrieves URL of the currently displayed page for a specific language + /// + /// Two-letter language code (e.g., "es" for Spanish, "en" for English) + /// Language specific URL of the current page (e.g. website.com/es/page) public Task GetCurrentPageUrlForLanguage(string language); + + /// + /// Retrieves URL of the specified page for a specific language + /// + /// Guid of the webpage to retrieve a URL of. + /// Two-letter language code (e.g., "es" for Spanish, "en" for English) + /// Language specific URL of the current page (e.g. website.com/es/page) public Task GetPageRelativeUrl(Guid webpageGuid, string language); + + /// + /// Retrieves the value of the specified query string parameter + /// + /// The name of the query string parameter to retrieve + /// The value of the specified query string parameter public string GetQueryStringValue(string parameter); } From dd42d362514f42cec7f79209edd31cbab2d51da2 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Tue, 19 Nov 2024 15:57:19 -0500 Subject: [PATCH 42/60] GH-87 :: add membership service documentation --- .../Membership/Services/IMembershipService.cs | 75 ++++++++++++++++--- .../Membership/Services/MembershipService.cs | 9 +++ 2 files changed, 75 insertions(+), 9 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 0be12700..5a521d58 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -1,15 +1,72 @@ using Microsoft.AspNetCore.Identity; namespace TrainingGuides.Web.Features.Membership.Services; + +/// +/// Interface for membership services. +/// public interface IMembershipService { - public Task GetCurrentMember(); - public Task IsMemberAuthenticated(); - public Task CreateMember(GuidesMember guidesMember, string password); - public Task FindMemberByEmail(string email); - public Task FindMemberByName(string userName); - public Task ConfirmEmail(GuidesMember member, string confirmToken); - public Task SignIn(string userNameOrEmail, string password, bool staySignedIn); - public Task SignOut(); - public Task GenerateEmailConfirmationToken(GuidesMember member); + /// + /// Gets the current member. + /// + /// The current if found; otherwise, null. + Task GetCurrentMember(); + + /// + /// Checks if the member is authenticated. + /// + /// True if the member is authenticated; otherwise, false. + Task IsMemberAuthenticated(); + + /// + /// Creates a new member. + /// + /// The member to create. + /// The password for the member. + /// The result of the creation operation. + Task CreateMember(GuidesMember guidesMember, string password); + + /// + /// Finds a member by email. + /// + /// The email of the member to find. + /// The if found; otherwise, null. + Task FindMemberByEmail(string email); + + /// + /// Finds a member by username. + /// + /// The username of the member to find. + /// The if found; otherwise, null. + Task FindMemberByName(string userName); + + /// + /// Confirms the email of a member. + /// + /// The member whose email is to be confirmed. + /// The confirmation token. + /// The result of the confirmation operation. + Task ConfirmEmail(GuidesMember member, string confirmToken); + + /// + /// Signs in a member. + /// + /// The username or email of the member. + /// The password of the member. + /// Whether to keep the member signed in. + /// The result of the sign-in operation. + Task SignIn(string userNameOrEmail, string password, bool staySignedIn); + + /// + /// Signs out the current member. + /// + Task SignOut(); + + /// + /// Generates an email confirmation token for a member. + /// + /// The member for whom to generate the token. + /// The email confirmation token. + Task GenerateEmailConfirmationToken(GuidesMember member); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index e272e20b..20af5569 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -25,6 +25,7 @@ public MembershipService( this.memberContactService = memberContactService; } + /// public async Task GetCurrentMember() { var context = contextAccessor.HttpContext; @@ -36,27 +37,33 @@ public MembershipService( return await userManager.GetUserAsync(context.User); } + /// public async Task IsMemberAuthenticated() { var member = await GetCurrentMember(); return member is not null; } + /// public async Task CreateMember(GuidesMember guidesMember, string password) => await userManager.CreateAsync(guidesMember, password); private async Task FindMemberByUserNameOrEmail(string userNameOrEmail) => await userManager.FindByNameAsync(userNameOrEmail) ?? await userManager.FindByEmailAsync(userNameOrEmail); + /// public async Task FindMemberByName(string userName) => await userManager.FindByNameAsync(userName); + /// public async Task FindMemberByEmail(string email) => await userManager.FindByEmailAsync(email); + /// public async Task ConfirmEmail(GuidesMember member, string confirmToken) => await userManager.ConfirmEmailAsync(member, confirmToken); + /// public async Task SignIn(string userNameOrEmail, string password, bool staySignedIn) { try @@ -89,6 +96,7 @@ public async Task SignIn(string userNameOrEmail, string password, } } + /// public async Task SignOut() { await signInManager.SignOutAsync(); @@ -96,6 +104,7 @@ public async Task SignOut() memberContactService.RemoveContactCookies(); } + /// public async Task GenerateEmailConfirmationToken(GuidesMember member) => await userManager.GenerateEmailConfirmationTokenAsync(member); } From d0738fae2ccd9cd2ebf07a69e6eb23aedaa0ef91 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 20 Nov 2024 11:25:15 -0500 Subject: [PATCH 43/60] GH-86 :: Fix localization in registration action --- .../Membership/Controllers/RegistrationController.cs | 3 ++- .../Widgets/Registration/RegistrationWidget.cshtml | 2 +- .../Registration/RegistrationWidgetViewComponent.cs | 8 +++++++- .../Widgets/Registration/RegistrationWidgetViewModel.cs | 6 ++++++ src/TrainingGuides.Web/Resources/SharedResources.es.resx | 3 +++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 11162f61..5c0bd8f6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -13,6 +13,7 @@ using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.Registration; using TrainingGuides.Web.Features.Shared.Services; +using TrainingGuides.Web.Features.Shared.Helpers; namespace TrainingGuides.Web.Features.Membership.Controllers; @@ -32,7 +33,7 @@ public class RegistrationController( private readonly SystemEmailOptions systemEmailOptions = systemEmailOptions.Value; private readonly IHttpRequestService httpRequestService = httpRequestService; - [HttpPost("/Registration/Register")] + [HttpPost("{" + ApplicationConstants.LANGUAGE_KEY + "}/Registration/Register")] [ValidateAntiForgeryToken] public async Task Register(RegistrationWidgetViewModel model) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml index d2589166..4c9bd4d1 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidget.cshtml @@ -25,7 +25,7 @@ HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = formDivId - }, new { action = $"{Model.BaseUrl}/Registration/Register" })) + }, new { action = $"{Model.BaseUrl}/{Model.Language}/Registration/Register" })) {
diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs index 1bc9c233..1195c8b6 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponent.cs @@ -1,5 +1,6 @@ +using Kentico.Content.Web.Mvc.Routing; using Kentico.PageBuilder.Web.Mvc; using Microsoft.AspNetCore.Mvc; using TrainingGuides.Web.Features.Membership.Services; @@ -21,18 +22,23 @@ public class RegistrationWidgetViewComponent : ViewComponent { private readonly IHttpRequestService httpRequestService; private readonly IMembershipService membershipService; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; public const string IDENTIFIER = "TrainingGuides.RegistrationWidget"; - public RegistrationWidgetViewComponent(IHttpRequestService httpRequestService, IMembershipService membershipService) + public RegistrationWidgetViewComponent(IHttpRequestService httpRequestService, + IMembershipService membershipService, + IPreferredLanguageRetriever preferredLanguageRetriever) { this.httpRequestService = httpRequestService; this.membershipService = membershipService; + this.preferredLanguageRetriever = preferredLanguageRetriever; } public async Task BuildWidgetViewModel(RegistrationWidgetProperties properties) => new() { BaseUrl = httpRequestService.GetBaseUrl(), + Language = preferredLanguageRetriever.Get(), DisplayForm = !await membershipService.IsMemberAuthenticated(), ShowName = properties.ShowName, ShowExtraFields = properties.ShowExtraFields, diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs index 05918836..14342085 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs @@ -26,6 +26,12 @@ public class RegistrationWidgetViewModel : WidgetViewModel [HiddenInput] public string BaseUrl { get; set; } = string.Empty; + /// + /// The language of the current request + /// + [HiddenInput] + public string Language { get; set; } = string.Empty; + /// /// Determines whether the widget should display the form. /// diff --git a/src/TrainingGuides.Web/Resources/SharedResources.es.resx b/src/TrainingGuides.Web/Resources/SharedResources.es.resx index b93ab743..c199c514 100644 --- a/src/TrainingGuides.Web/Resources/SharedResources.es.resx +++ b/src/TrainingGuides.Web/Resources/SharedResources.es.resx @@ -159,6 +159,9 @@ ¡Éxito! + + ¡Éxito! Se hemos enviado un email. Confirme su membresía haciendo clic en el enlace incluido en el correo electrónico. + Error en el registro. From e8fe8809067b26c85a6dc3985847b193ea405ec8 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 20 Nov 2024 12:54:41 -0500 Subject: [PATCH 44/60] GH-90 :: Add language checks when redirecting 403 to sign in page --- .../Controllers/AuthenticationController.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index f065aeae..fd63fd69 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -6,6 +6,8 @@ using TrainingGuides.Web.Features.Shared.Helpers; using CMS.Websites.Routing; using Kentico.Content.Web.Mvc.Routing; +using CMS.DataEngine; +using CMS.ContentEngine; namespace TrainingGuides.Web.Features.Membership.Controllers; @@ -17,17 +19,20 @@ public class AuthenticationController : Controller private readonly IWebPageUrlRetriever webPageUrlRetriever; private readonly IWebsiteChannelContext websiteChannelContext; private readonly IPreferredLanguageRetriever preferredLanguageRetriever; + private readonly IInfoProvider contentLanguageInfoProvider; private const string SIGN_IN_FAILED = "Your sign-in attempt was not successful. Please try again."; public AuthenticationController(IMembershipService membershipService, IWebPageUrlRetriever webPageUrlRetriever, IWebsiteChannelContext websiteChannelContext, - IPreferredLanguageRetriever preferredLanguageRetriever) + IPreferredLanguageRetriever preferredLanguageRetriever, + IInfoProvider contentLanguageInfoProvider) { this.membershipService = membershipService; this.webPageUrlRetriever = webPageUrlRetriever; this.websiteChannelContext = websiteChannelContext; this.preferredLanguageRetriever = preferredLanguageRetriever; + this.contentLanguageInfoProvider = contentLanguageInfoProvider; } private IActionResult RenderError(SignInWidgetViewModel model) @@ -76,14 +81,32 @@ public async Task SignOut(SignOutFormModel model) [HttpGet(ApplicationConstants.ACCESS_DENIED_CONTROLLER_PATH)] public async Task AccessDenied([FromQuery(Name = ApplicationConstants.RETURN_URL_PARAMETER)] string returnUrl) { + string language = GetLanguageFromReturnUrl(returnUrl); + var signInUrl = await webPageUrlRetriever.Retrieve( webPageTreePath: ApplicationConstants.EXPECTED_SIGN_IN_PATH, websiteChannelName: websiteChannelContext.WebsiteChannelName, - languageName: preferredLanguageRetriever.Get() + languageName: language ); string redirectUrl = signInUrl.RelativePath + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, returnUrl); return Redirect(redirectUrl); } + + private string GetLanguageFromReturnUrl(string returnUrl) + { + var languages = contentLanguageInfoProvider.Get() + .Column(nameof(ContentLanguageInfo.ContentLanguageName)); + + foreach (var language in languages) + { + if (returnUrl.StartsWith($"/{language.ContentLanguageName}/") || returnUrl.StartsWith($"~/{language.ContentLanguageName}/")) + { + return language.ContentLanguageName; + } + } + // Since this controller action has no language in its path, this will return the channel default. + return preferredLanguageRetriever.Get(); + } } \ No newline at end of file From 351603bc7c3458ff3fefa07e41aaf52b6c3b9da9 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 20 Nov 2024 13:57:11 -0500 Subject: [PATCH 45/60] GH-89 :: Merge contacts when signing in --- .../Features/Membership/Services/IMemberContactService.cs | 6 ++++++ .../Features/Membership/Services/MemberContactService.cs | 8 +++++++- .../Features/Membership/Services/MembershipService.cs | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs index 09145871..af856bb8 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMemberContactService.cs @@ -40,6 +40,12 @@ public interface IMemberContactService /// The member to find an associated contact for void SetCurrentContactForMember(GuidesMember member); + /// + /// Merges the provided contact based on the provided email address + /// + /// The contact to merge + public void MergeContactByEmail(ContactInfo contact); + /// /// Removes contact related cookies /// diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs index 8d06c7eb..50d6866b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MemberContactService.cs @@ -11,14 +11,17 @@ public class MemberContactService : IMemberContactService private readonly IInfoProvider contactInfoProvider; private readonly ICookieAccessor cookieAccessor; private readonly ICurrentContactProvider currentContactProvider; + private readonly IContactMergeService contactMergeService; public MemberContactService(IInfoProvider contactInfoProvider, ICookieAccessor cookieAccessor, - ICurrentContactProvider currentContactProvider) + ICurrentContactProvider currentContactProvider, + IContactMergeService contactMergeService) { this.contactInfoProvider = contactInfoProvider; this.cookieAccessor = cookieAccessor; this.currentContactProvider = currentContactProvider; + this.contactMergeService = contactMergeService; } /// @@ -92,6 +95,9 @@ public void SetCurrentContactForMember(GuidesMember member) } } + /// + public void MergeContactByEmail(ContactInfo contact) => contactMergeService.MergeContactByEmail(contact); + /// public void RemoveContactCookies() { diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 20af5569..9c68a0e7 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -84,6 +84,8 @@ public async Task SignIn(string userNameOrEmail, string password, memberContactService.UpdateContactIfChanged(contact); + memberContactService.MergeContactByEmail(contact); + memberContactService.SetCurrentContactForMember(member); } From 30f93fbd077b5274370caf50c25da65dfee6f0bb Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 21 Nov 2024 10:25:53 -0500 Subject: [PATCH 46/60] GH-90 :: Add functionality to hide or prompt login in listing page for secured articles --- .../aboutconfiers-43kzvzza.xml | 2 +- ...5-4666-9502-80083879519a_en@1757274891.xml | 7 ++- .../Articles/ArticlePagePageTemplate.cshtml | 4 ++ .../Articles/Services/ArticlePageService.cs | 55 ++++++++++++++++--- .../Articles/Services/IArticlePageService.cs | 16 +++++- .../ArticleListWidgetProperties.cs | 16 ++++++ .../ArticleListWidgetViewComponent.cs | 20 +++++-- .../Membership/Services/IMembershipService.cs | 7 +++ .../Membership/Services/MembershipService.cs | 22 +++++++- .../Services/ContentItemRetrieverService.cs | 23 ++++++-- .../Services/IContentItemRetrieverService.cs | 2 + 11 files changed, 150 insertions(+), 24 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/aboutconfiers-43kzvzza.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/aboutconfiers-43kzvzza.xml index 0bf75823..c624ec32 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/aboutconfiers-43kzvzza.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/aboutconfiers-43kzvzza.xml @@ -12,6 +12,6 @@ c155bcf9-1300-47ea-a76e-4070f2b4ae72 False - False + True AboutConfiers-43kzvzza \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml index 87185ebe..baf48eed 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml @@ -12,9 +12,12 @@ 81c6968d-ccf5-4666-9502-80083879519a True - 2024-02-06 21:57:01Z + 2024-11-20 21:33:49Z + + + - + 2 diff --git a/src/TrainingGuides.Web/Features/Articles/ArticlePagePageTemplate.cshtml b/src/TrainingGuides.Web/Features/Articles/ArticlePagePageTemplate.cshtml index 714e582d..8af07e75 100644 --- a/src/TrainingGuides.Web/Features/Articles/ArticlePagePageTemplate.cshtml +++ b/src/TrainingGuides.Web/Features/Articles/ArticlePagePageTemplate.cshtml @@ -17,4 +17,8 @@

@templateModel.Text

+ +
+
+
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs b/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs index 532b7838..3ab4ec11 100644 --- a/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs +++ b/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs @@ -1,4 +1,8 @@ +using Kentico.Content.Web.Mvc.Routing; using Microsoft.AspNetCore.Html; +using Microsoft.Extensions.Localization; +using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Shared.Helpers; using TrainingGuides.Web.Features.Shared.Models; namespace TrainingGuides.Web.Features.Articles.Services; @@ -6,16 +10,22 @@ namespace TrainingGuides.Web.Features.Articles.Services; public class ArticlePageService : IArticlePageService { private readonly IWebPageUrlRetriever webPageUrlRetriever; - public ArticlePageService(IWebPageUrlRetriever webPageUrlRetriever) + private readonly IServiceProvider serviceProvider; + private readonly IStringLocalizer stringLocalizer; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; + public ArticlePageService(IWebPageUrlRetriever webPageUrlRetriever, + IServiceProvider serviceProvider, + IStringLocalizer stringLocalizer, + IPreferredLanguageRetriever preferredLanguageRetriever) { this.webPageUrlRetriever = webPageUrlRetriever; + this.serviceProvider = serviceProvider; + this.stringLocalizer = stringLocalizer; + this.preferredLanguageRetriever = preferredLanguageRetriever; } - /// - /// Creates a new instance of , setting the properties using ArticlePage given as a parameter. - /// - /// Corresponding Article page object. - /// New instance of ArticlePageViewModel. + + /// public async Task GetArticlePageViewModel(ArticlePage? articlePage) { if (articlePage == null) @@ -23,7 +33,7 @@ public async Task GetArticlePageViewModel(ArticlePage? art return new ArticlePageViewModel(); } - string articleUrl = (await webPageUrlRetriever.Retrieve(articlePage)).RelativePath; + string articleUrl = (await webPageUrlRetriever.Retrieve(articlePage.SystemFields.WebPageItemGUID, preferredLanguageRetriever.Get())).RelativePath; var articleSchema = articlePage.ArticlePageArticleContent.FirstOrDefault(); if (articleSchema != null) @@ -54,4 +64,35 @@ public async Task GetArticlePageViewModel(ArticlePage? art Url = articleUrl }; } + + /// + public async Task GetArticlePageViewModelWithSecurity(ArticlePage? articlePage) + { + var originalViewModel = await GetArticlePageViewModel(articlePage); + + using (var scope = serviceProvider.CreateScope()) + { + var membershipService = scope.ServiceProvider.GetRequiredService(); + + if (articlePage is not null + && articlePage.SystemFields.ContentItemIsSecured + && !await membershipService.IsMemberAuthenticated()) + { + string signInUrl = await membershipService.GetSignInUrl(preferredLanguageRetriever.Get()); + + string signInUrlWithReturn = signInUrl + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, originalViewModel.Url).ToString(); + + return new ArticlePageViewModel + { + Title = $"{stringLocalizer["(🔒 Locked)"]} {originalViewModel.Title}", + Summary = new HtmlString(stringLocalizer["Sign in to view this content."]), + Text = new HtmlString(stringLocalizer["Sign in to view this content."]), + CreatedOn = articlePage.ArticlePagePublishDate, + TeaserImage = originalViewModel.TeaserImage, + Url = signInUrlWithReturn + }; + } + } + return originalViewModel; + } } diff --git a/src/TrainingGuides.Web/Features/Articles/Services/IArticlePageService.cs b/src/TrainingGuides.Web/Features/Articles/Services/IArticlePageService.cs index bf5a48ab..790fd94d 100644 --- a/src/TrainingGuides.Web/Features/Articles/Services/IArticlePageService.cs +++ b/src/TrainingGuides.Web/Features/Articles/Services/IArticlePageService.cs @@ -2,5 +2,19 @@ namespace TrainingGuides.Web.Features.Articles.Services; public interface IArticlePageService { - public Task GetArticlePageViewModel(ArticlePage? articlePage); + /// + /// Creates a new instance of , setting the properties using ArticlePage given as a parameter. + /// + /// Corresponding Article page object. + /// New instance of ArticlePageViewModel. + Task GetArticlePageViewModel(ArticlePage? articlePage); + + /// + /// Creates a new instance of , setting the properties using ArticlePage given as a parameter. + /// + /// Corresponding Article page object. + /// New instance of ArticlePageViewModel. + /// + /// If the articlePage is secured and the current visitor is not authenticated, the view model will prompt them to sign in. + Task GetArticlePageViewModelWithSecurity(ArticlePage? articlePage); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetProperties.cs b/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetProperties.cs index 69decfbb..d7cdc69f 100644 --- a/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetProperties.cs +++ b/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetProperties.cs @@ -38,6 +38,12 @@ public class ArticleListWidgetProperties : IWidgetProperties DataProviderType = typeof(DropdownEnumOptionProvider), Order = 40)] public string OrderBy { get; set; } = OrderByOption.NewestFirst.ToString(); + + [DropDownComponent( + Label = "Secured items", + DataProviderType = typeof(DropdownEnumOptionProvider), + Order = 50)] + public string SecuredItems { get; set; } = SecuredOption.IncludeEverything.ToString(); } public enum OrderByOption @@ -46,4 +52,14 @@ public enum OrderByOption NewestFirst, [Description("Oldest first")] OldestFirst +} + +public enum SecuredOption +{ + [Description("Include everything")] + IncludeEverything, + [Description("Prompt for login")] + PromptForLogin, + [Description("Hide secured items")] + HideSecuredItems } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewComponent.cs index 2b2c66a1..a70a94cf 100644 --- a/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewComponent.cs @@ -39,11 +39,11 @@ public async Task InvokeAsync(ArticleListWidgetProperti if (!properties.ContentTreeSection.IsNullOrEmpty()) { - var articlePages = await RetrieveArticlePages(properties.ContentTreeSection.First(), properties.Tags); + var articlePages = await RetrieveArticlePages(properties.ContentTreeSection.First(), properties.Tags, properties.SecuredItems); model.Articles = (properties.OrderBy.Equals(OrderByOption.OldestFirst.ToString()) - ? (await GetArticlePageViewModels(articlePages)).OrderBy(article => article.CreatedOn) - : (await GetArticlePageViewModels(articlePages)).OrderByDescending(article => article.CreatedOn)) + ? (await GetArticlePageViewModels(articlePages, properties.SecuredItems)).OrderBy(article => article.CreatedOn) + : (await GetArticlePageViewModels(articlePages, properties.SecuredItems)).OrderByDescending(article => article.CreatedOn)) .Take(properties.TopN) .ToList(); @@ -53,8 +53,11 @@ public async Task InvokeAsync(ArticleListWidgetProperti return View("~/Features/Articles/Widgets/ArticleList/ArticleListWidget.cshtml", model); } - private async Task> RetrieveArticlePages(WebPageRelatedItem parentPageSelection, IEnumerable tags) + private async Task> RetrieveArticlePages(WebPageRelatedItem parentPageSelection, IEnumerable tags, string securedItems) { + bool includeSecuredItems = securedItems.Equals(SecuredOption.IncludeEverything.ToString()) + || securedItems.Equals(SecuredOption.PromptForLogin.ToString()); + var selectedPageGuid = parentPageSelection.WebPageGuid; var selectedPage = await genericPageRetrieverService.RetrieveWebPageByGuid(selectedPageGuid); @@ -66,6 +69,7 @@ private async Task> RetrieveArticlePages(WebPageRelated return await articlePageRetrieverService.RetrieveWebPageChildrenByPath( selectedPageContentTypeName, selectedPagePath, + includeSecuredItems, 3); } else @@ -84,6 +88,7 @@ await genericPageRetrieverService.RetrieveContentItemsBySchemaAndTags( selectedPagePath, nameof(ArticlePage.ArticlePageArticleContent), taggedArticleIds, + includeSecuredItems, 3); } } @@ -115,7 +120,7 @@ private async Task GetWebPageContentTypeName(Guid id) return await query.GetScalarResultAsync(); } - private async Task> GetArticlePageViewModels(IEnumerable? articlePages) + private async Task> GetArticlePageViewModels(IEnumerable? articlePages, string securedItems) { var models = new List(); if (articlePages != null) @@ -124,7 +129,10 @@ private async Task> GetArticlePageViewModels(IEnumera { if (articlePage != null) { - var model = await articlePageService.GetArticlePageViewModel(articlePage); + var model = securedItems.Equals(SecuredOption.PromptForLogin.ToString()) + ? await articlePageService.GetArticlePageViewModelWithSecurity(articlePage) + : await articlePageService.GetArticlePageViewModel(articlePage); + models.Add(model); } } diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 5a521d58..50fe52ba 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -69,4 +69,11 @@ public interface IMembershipService /// The member for whom to generate the token. /// The email confirmation token. Task GenerateEmailConfirmationToken(GuidesMember member); + + /// + /// Gets the URL of the expected sign in page in the provided language. + /// + /// The required language to retrieve. + /// The relative path of the sign in page. + Task GetSignInUrl(string language); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 9c68a0e7..b4bfafeb 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -1,6 +1,8 @@ using CMS.ContactManagement; using CMS.Core; +using CMS.Websites.Routing; using Microsoft.AspNetCore.Identity; +using TrainingGuides.Web.Features.Shared.Helpers; namespace TrainingGuides.Web.Features.Membership.Services; public class MembershipService : IMembershipService @@ -10,19 +12,25 @@ public class MembershipService : IMembershipService private readonly IHttpContextAccessor contextAccessor; private readonly IEventLogService eventLogService; private readonly IMemberContactService memberContactService; + private readonly IWebPageUrlRetriever webPageUrlRetriever; + private readonly IWebsiteChannelContext websiteChannelContext; public MembershipService( UserManager userManager, SignInManager signInManager, IHttpContextAccessor contextAccessor, IEventLogService eventLogService, - IMemberContactService memberContactService) + IMemberContactService memberContactService, + IWebPageUrlRetriever webPageUrlRetriever, + IWebsiteChannelContext websiteChannelContext) { this.userManager = userManager; this.signInManager = signInManager; this.contextAccessor = contextAccessor; this.eventLogService = eventLogService; this.memberContactService = memberContactService; + this.webPageUrlRetriever = webPageUrlRetriever; + this.websiteChannelContext = websiteChannelContext; } /// @@ -109,4 +117,16 @@ public async Task SignOut() /// public async Task GenerateEmailConfirmationToken(GuidesMember member) => await userManager.GenerateEmailConfirmationTokenAsync(member); + + /// + public async Task GetSignInUrl(string language) + { + var signInUrl = await webPageUrlRetriever.Retrieve( + webPageTreePath: ApplicationConstants.EXPECTED_SIGN_IN_PATH, + websiteChannelName: websiteChannelContext.WebsiteChannelName, + languageName: language + ); + + return signInUrl.RelativePath; + } } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs index 811cd3f8..6b0c7625 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs @@ -94,12 +94,19 @@ public async Task> RetrieveWebPageContentItems( ///
/// Content type of the parent page /// Path of the parent page + /// Determines whether secured items should be included in the results. /// The maximum level of recursively linked content items that should be included in the results. Default value is 1. /// public async Task> RetrieveWebPageChildrenByPath( string parentPageContentTypeName, string parentPagePath, - int depth = 1) => await RetrieveWebPageChildrenByPath(parentPageContentTypeName, parentPagePath, null, depth); + bool includeSecuredItems, + int depth = 1) => await RetrieveWebPageChildrenByPath( + parentPageContentTypeName: parentPageContentTypeName, + parentPagePath: parentPagePath, + customContentTypeQueryParameters: null, + includeSecuredItems: includeSecuredItems, + depth: depth); /// /// Retrieves child pages of a given web page that are linked to specific content items, specified by list of reference IDs. @@ -115,12 +122,14 @@ public async Task> RetrieveWebPageChildrenByPathAndReference( string parentPagePath, string referenceFieldName, IEnumerable referenceIds, + bool includeSecuredItems, int depth = 1 ) => await RetrieveWebPageChildrenByPath( - parentPageContentTypeName, - parentPagePath, - config => config.Linking(referenceFieldName, referenceIds), - depth); + parentPageContentTypeName: parentPageContentTypeName, + parentPagePath: parentPagePath, + customContentTypeQueryParameters: config => config.Linking(referenceFieldName, referenceIds), + includeSecuredItems: includeSecuredItems, + depth: depth); /// /// Retrieves Web page content item by Id using ContentItemQueryBuilder @@ -173,6 +182,7 @@ private async Task> RetrieveWebPageChildrenByPath( string parentPageContentTypeName, string parentPagePath, Action? customContentTypeQueryParameters, + bool includeSecuredItems = true, int depth = 1) { Action contentQueryParameters = customContentTypeQueryParameters != null @@ -193,7 +203,8 @@ private async Task> RetrieveWebPageChildrenByPath( var queryExecutorOptions = new ContentQueryExecutionOptions { - ForPreview = webSiteChannelContext.IsPreview + ForPreview = webSiteChannelContext.IsPreview, + IncludeSecuredItems = includeSecuredItems }; var pages = await contentQueryExecutor.GetMappedWebPageResult(builder, queryExecutorOptions); diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs index a31059ea..49636b20 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs @@ -18,6 +18,7 @@ public Task> RetrieveWebPageContentItems(string contentTypeName, public Task> RetrieveWebPageChildrenByPath( string parentPageContentTypeName, string path, + bool includeSecuredItems, int depth = 1); public Task> RetrieveWebPageChildrenByPathAndReference( @@ -25,6 +26,7 @@ public Task> RetrieveWebPageChildrenByPathAndReference( string parentPagePath, string referenceFieldName, IEnumerable referenceIds, + bool includeSecuredItems, int depth = 1 ); From ee349d68071ea3bda8801084e56e372924d4daa7 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 21 Nov 2024 10:34:20 -0500 Subject: [PATCH 47/60] GH-90 :: adjust widget configuration on widget samples page to include new column --- .../2bc61792-947f-4750-92a3-11a3f0b2e1a1_en@9f4c658660.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/widgetsamples-qyagaxb2@ef49a8813e/2bc61792-947f-4750-92a3-11a3f0b2e1a1_en@9f4c658660.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/widgetsamples-qyagaxb2@ef49a8813e/2bc61792-947f-4750-92a3-11a3f0b2e1a1_en@9f4c658660.xml index 351b3cd2..bc016c93 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/widgetsamples-qyagaxb2@ef49a8813e/2bc61792-947f-4750-92a3-11a3f0b2e1a1_en@9f4c658660.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/widgetsamples-qyagaxb2@ef49a8813e/2bc61792-947f-4750-92a3-11a3f0b2e1a1_en@9f4c658660.xml @@ -13,9 +13,9 @@ 2024-02-05 17:57:39Z 2bc61792-947f-4750-92a3-11a3f0b2e1a1 True - 2024-08-27 17:46:31Z + 2024-11-21 15:31:39Z - This page contains example usage of widgets that are similar to widgets seen in the Xperience by Kentico demo page.

"},"fieldIdentifiers":{"content":"5cf16e61-354d-4a34-b421-3ccbc64e0858"}}]},{"identifier":"9fd80f32-d748-4656-b250-3e00413360d2","type":"TrainingGuides.CallToActionWidget","variants":[{"identifier":"dfa4af7f-b1ba-427a-9937-154023dbd02f","properties":{"text":"Read more","type":"page","targetPage":"~/news","contentItem":[],"absoluteUrl":"","isDownload":false,"identifier":null,"openInNewTab":false},"fieldIdentifiers":{"text":"ad515169-15ab-4631-9c99-0fdda8a4cabb","type":"0f756769-f45b-4659-858b-3170185d7f29","targetPage":"1e3d102d-2511-463b-9b3e-f3d70d0e1934","contentItem":"edee65a8-3690-4859-83d3-afcb873b7f59","absoluteUrl":"a501c256-0837-49d2-bc3d-a5638a3d529d","isDownload":"f6038b2b-ac96-4c22-b472-9609c80d16b8","identifier":"5b91e214-6bdb-4d61-ad52-f24a6928c8b4","openInNewTab":"141df6e9-e5a9-4910-a6e3-c15d94134cc9"}}]},{"identifier":"c096b68e-fe41-473b-9369-ed511db248ab","type":"TrainingGuides.HtmlCodeWidget","variants":[{"identifier":"1eef413a-487f-47da-be37-05f9ed94f9ac","properties":{"code":"

This text was added as Html through the Html code widget

","insertToHead":false},"fieldIdentifiers":{"code":"3fbd3f6a-cf6e-424d-bfe5-21c1234cfee9","insertToHead":"bcb66b93-d3bc-464e-b96d-f9bee9b75287"}}]},{"identifier":"28c2a900-f150-4035-86ae-dfab5e99a2d6","type":"TrainingGuides.HeroBanner","variants":[{"identifier":"f1536a8b-18f1-4ec2-a533-e90601ec0c56","properties":{"mode":"heroContentItem","productPageAnchor":"","productPage":[],"hero":[{"identifier":"f56a7c73-21d5-4604-8729-11cf5c74563f"}],"selectedProductPageAnchor":"","cta":null,"displayCTA":true,"openInNewTab":false,"changeDesign":true,"textColor":"Dark","showBenefits":true,"showImage":true,"width":"circle"},"fieldIdentifiers":{"mode":"419e04ac-fe70-4994-aea4-ecdaa3ffd194","productPageAnchor":"e8bcaf96-42f3-4f3e-bbf1-b2b74d25ded1","productPage":"4f7ab742-14de-42d3-b696-1e9197af4586","selectedProductPageAnchor":"b458e7a8-0cff-4350-8265-617f1ba27e77","hero":"2c515840-51cc-463d-9ecc-fd9fa557f731","cta":"3ddd63df-073a-4998-8006-df3355afa24b","displayCTA":"f1a2a3d7-4b00-4ee1-97e5-f072c6bd4d5c","openInNewTab":"46363e60-6e12-479a-9a59-64db42f58c48","changeDesign":"66c8c6b2-358a-445f-81dc-555200c8469e","showBenefits":"0facb279-680d-4f63-a88b-317f3f9f1aad","showImage":"de169e42-651d-49b4-ba3b-bdffef91d9f5","width":"4cd4fd88-a7ed-4d6f-a2b8-e2f70bd56f7f","textColor":"ebdf6005-46d7-4f98-b7db-353003230a1a"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"3624ad74-5f9f-43dc-a9e6-e004e7dab319"}},{"identifier":"b63bd01f-a73c-48c6-b65e-2ae8a679ad85","type":"TrainingGuides.SingleColumnSection","properties":{"sectionAnchor":null},"zones":[{"identifier":"72dfa06b-f233-440a-8997-b90a5c32d556","widgets":[{"identifier":"a9d35e89-ae5c-4dde-9910-95ab467b0516","type":"TrainingGuides.ProductComparatorWidget","variants":[{"identifier":"c7019377-095f-4b1a-b310-33b03320a86a","properties":{"products":[{"webPageGuid":"29d47791-2031-47ca-ae0f-f6ce0e2dbd81"},{"webPageGuid":"fd3fd667-4404-4c08-9cc0-da3a42fd813c"}],"comparatorHeading":"Compare these products","headingType":"H3","headingMargin":"Large","callToAction":"See more","showShortDescription":true,"showPrice":true},"fieldIdentifiers":{"products":"f7bd156f-5926-4e59-b2a0-035b7eabfe6c","comparatorHeading":"a84a930a-7954-4f84-955c-277ea0aff43e","headingType":"3ced4bb7-5535-49a2-b085-d18a6b6b6bac","headingMargin":"3a8ad32e-b4f1-4bd1-ab4a-1cc1f71aaa5b","callToAction":"5afa859f-a916-4f98-87ab-3c5a0bdc62a4","showShortDescription":"52536c17-17e3-40c9-aff0-0e73335f9f76","showPrice":"e23b787d-aecf-4e0e-86c2-53a21c23c295"}}]},{"identifier":"3860c052-823a-4273-995e-58cb24485124","type":"TrainingGuides.ArticleListWidget","variants":[{"identifier":"3b66a384-ceae-4b64-9a6a-fa4bff300824","properties":{"contentTreeSection":[{"webPageGuid":"77c7aa1f-e0e3-4b74-a66f-8c0c87523c15"}],"topN":10,"ctaText":"Read more","orderBy":"NewestFirst"},"fieldIdentifiers":{"contentTreeSection":"d8d852f2-1c7a-4a6d-bb7d-61c507347d9b","topN":"c71177a6-8b72-44b3-9fac-ee72d7246c4d","ctaText":"13a01e21-11ed-4079-a394-dac03460f54e","orderBy":"8c026cca-c4e4-4cfc-acdf-35c0c05ecc9c"}}]},{"identifier":"6d88af4e-510e-4322-91bf-8b2eafc1e7e7","type":"TrainingGuides.FeaturedArticleWidget","conditionType":"TrainingGuides.Web.Features.Personalization","variants":[{"identifier":"4105d9a9-4210-4fe6-8d24-021e50e9cf20","properties":{"article":[{"webPageGuid":"e637f5c7-7b4d-4359-a638-0956eedff300"}]},"fieldIdentifiers":{"article":"73ff6341-f3b5-4098-86e0-e88e1a5ec1f7"}},{"identifier":"01400b28-9324-4bec-afc9-c626b4b5aad5","name":"Espresso lovers","properties":{"article":[{"webPageGuid":"c48419d1-41d5-4fb5-91a3-32968bd8aeb3"}]},"conditionTypeParameters":{"selectedContactGroups":[{"objectGuid":null,"objectCodeName":"EspressoLovers"}],"variantName":null},"fieldIdentifiers":{"article":"d6cac4e5-c0a2-4661-9b38-1661b37b238d"}}]},{"identifier":"dca67df2-b30d-473d-87d3-b2f0c8750d7d","type":"TrainingGuides.VideoEmbedWidget","variants":[{"identifier":"1a49df0b-230c-45a6-906b-a5ddc4ebba73","properties":{"service":"youtube","url":"https://youtu.be/Uyr0J6Ws4R8","dynamicSize":true,"width":560,"height":315,"playFromBeginning":true,"startingTime":0},"fieldIdentifiers":{"service":"a7f3de3b-91a6-4524-9803-4d8a6032387d","url":"0e30abd4-5031-44fe-a5ca-a343924c9f13","dynamicSize":"d2f7f695-a972-449b-a048-7ff72a9f641f","width":"b27d0cf3-9e34-4b5b-8386-a802e1f5f647","height":"54c167f1-2336-4881-b200-bd7df2f99bfe","playFromBeginning":"2bee441e-45a8-42d2-ab2d-897d2a3cfdef","startingTime":"83fd259e-6d29-4750-b4c2-b7e066bf8af8"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"61d9d55a-1fe3-4e93-959c-107552e8f1d6"}}]}]}]]> + This page contains example usage of widgets that are similar to widgets seen in the Xperience by Kentico demo page.

"},"fieldIdentifiers":{"content":"5cf16e61-354d-4a34-b421-3ccbc64e0858"}}]},{"identifier":"9fd80f32-d748-4656-b250-3e00413360d2","type":"TrainingGuides.CallToActionWidget","variants":[{"identifier":"dfa4af7f-b1ba-427a-9937-154023dbd02f","properties":{"text":"Read more","type":"page","targetPage":"~/news","contentItem":[],"absoluteUrl":"","isDownload":false,"identifier":null,"openInNewTab":false},"fieldIdentifiers":{"text":"ad515169-15ab-4631-9c99-0fdda8a4cabb","type":"0f756769-f45b-4659-858b-3170185d7f29","targetPage":"1e3d102d-2511-463b-9b3e-f3d70d0e1934","contentItem":"edee65a8-3690-4859-83d3-afcb873b7f59","absoluteUrl":"a501c256-0837-49d2-bc3d-a5638a3d529d","isDownload":"f6038b2b-ac96-4c22-b472-9609c80d16b8","identifier":"5b91e214-6bdb-4d61-ad52-f24a6928c8b4","openInNewTab":"141df6e9-e5a9-4910-a6e3-c15d94134cc9"}}]},{"identifier":"c096b68e-fe41-473b-9369-ed511db248ab","type":"TrainingGuides.HtmlCodeWidget","variants":[{"identifier":"1eef413a-487f-47da-be37-05f9ed94f9ac","properties":{"code":"

This text was added as Html through the Html code widget

","insertToHead":false},"fieldIdentifiers":{"code":"3fbd3f6a-cf6e-424d-bfe5-21c1234cfee9","insertToHead":"bcb66b93-d3bc-464e-b96d-f9bee9b75287"}}]},{"identifier":"28c2a900-f150-4035-86ae-dfab5e99a2d6","type":"TrainingGuides.HeroBanner","variants":[{"identifier":"f1536a8b-18f1-4ec2-a533-e90601ec0c56","properties":{"mode":"heroContentItem","productPageAnchor":"","productPage":[],"hero":[{"identifier":"f56a7c73-21d5-4604-8729-11cf5c74563f"}],"selectedProductPageAnchor":"","cta":null,"displayCTA":true,"openInNewTab":false,"changeDesign":true,"textColor":"Dark","showBenefits":true,"showImage":true,"width":"circle"},"fieldIdentifiers":{"mode":"419e04ac-fe70-4994-aea4-ecdaa3ffd194","productPageAnchor":"e8bcaf96-42f3-4f3e-bbf1-b2b74d25ded1","productPage":"4f7ab742-14de-42d3-b696-1e9197af4586","selectedProductPageAnchor":"b458e7a8-0cff-4350-8265-617f1ba27e77","hero":"2c515840-51cc-463d-9ecc-fd9fa557f731","cta":"3ddd63df-073a-4998-8006-df3355afa24b","displayCTA":"f1a2a3d7-4b00-4ee1-97e5-f072c6bd4d5c","openInNewTab":"46363e60-6e12-479a-9a59-64db42f58c48","changeDesign":"66c8c6b2-358a-445f-81dc-555200c8469e","showBenefits":"0facb279-680d-4f63-a88b-317f3f9f1aad","showImage":"de169e42-651d-49b4-ba3b-bdffef91d9f5","width":"4cd4fd88-a7ed-4d6f-a2b8-e2f70bd56f7f","textColor":"ebdf6005-46d7-4f98-b7db-353003230a1a"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"3624ad74-5f9f-43dc-a9e6-e004e7dab319"}},{"identifier":"b63bd01f-a73c-48c6-b65e-2ae8a679ad85","type":"TrainingGuides.SingleColumnSection","properties":{"sectionAnchor":null},"zones":[{"identifier":"72dfa06b-f233-440a-8997-b90a5c32d556","widgets":[{"identifier":"a9d35e89-ae5c-4dde-9910-95ab467b0516","type":"TrainingGuides.ProductComparatorWidget","variants":[{"identifier":"c7019377-095f-4b1a-b310-33b03320a86a","properties":{"products":[{"webPageGuid":"29d47791-2031-47ca-ae0f-f6ce0e2dbd81"},{"webPageGuid":"fd3fd667-4404-4c08-9cc0-da3a42fd813c"}],"comparatorHeading":"Compare these products","headingType":"H3","headingMargin":"Large","callToAction":"See more","showShortDescription":true,"showPrice":true},"fieldIdentifiers":{"products":"f7bd156f-5926-4e59-b2a0-035b7eabfe6c","comparatorHeading":"a84a930a-7954-4f84-955c-277ea0aff43e","headingType":"3ced4bb7-5535-49a2-b085-d18a6b6b6bac","headingMargin":"3a8ad32e-b4f1-4bd1-ab4a-1cc1f71aaa5b","callToAction":"5afa859f-a916-4f98-87ab-3c5a0bdc62a4","showShortDescription":"52536c17-17e3-40c9-aff0-0e73335f9f76","showPrice":"e23b787d-aecf-4e0e-86c2-53a21c23c295"}}]},{"identifier":"3860c052-823a-4273-995e-58cb24485124","type":"TrainingGuides.ArticleListWidget","variants":[{"identifier":"3b66a384-ceae-4b64-9a6a-fa4bff300824","properties":{"contentTreeSection":[{"webPageGuid":"77c7aa1f-e0e3-4b74-a66f-8c0c87523c15"}],"tags":[],"topN":10,"ctaText":"Read more","orderBy":"NewestFirst","securedItems":"IncludeEverything"},"fieldIdentifiers":{"contentTreeSection":"d8d852f2-1c7a-4a6d-bb7d-61c507347d9b","topN":"c71177a6-8b72-44b3-9fac-ee72d7246c4d","ctaText":"13a01e21-11ed-4079-a394-dac03460f54e","orderBy":"8c026cca-c4e4-4cfc-acdf-35c0c05ecc9c","tags":"10db8fbf-dc65-4654-86c1-5b84ae2ca6fd","securedItems":"2c34bb41-b4c4-482c-8fac-900c817a5a4c"}}]},{"identifier":"6d88af4e-510e-4322-91bf-8b2eafc1e7e7","type":"TrainingGuides.FeaturedArticleWidget","conditionType":"TrainingGuides.Web.Features.Personalization","variants":[{"identifier":"4105d9a9-4210-4fe6-8d24-021e50e9cf20","properties":{"article":[{"webPageGuid":"e637f5c7-7b4d-4359-a638-0956eedff300"}]},"fieldIdentifiers":{"article":"73ff6341-f3b5-4098-86e0-e88e1a5ec1f7"}},{"identifier":"01400b28-9324-4bec-afc9-c626b4b5aad5","name":"Espresso lovers","properties":{"article":[{"webPageGuid":"c48419d1-41d5-4fb5-91a3-32968bd8aeb3"}]},"conditionTypeParameters":{"selectedContactGroups":[{"objectGuid":null,"objectCodeName":"EspressoLovers"}],"variantName":null},"fieldIdentifiers":{"article":"d6cac4e5-c0a2-4661-9b38-1661b37b238d"}}]},{"identifier":"dca67df2-b30d-473d-87d3-b2f0c8750d7d","type":"TrainingGuides.VideoEmbedWidget","variants":[{"identifier":"1a49df0b-230c-45a6-906b-a5ddc4ebba73","properties":{"service":"youtube","url":"https://youtu.be/Uyr0J6Ws4R8","dynamicSize":true,"width":560,"height":315,"playFromBeginning":true,"startingTime":0},"fieldIdentifiers":{"service":"a7f3de3b-91a6-4524-9803-4d8a6032387d","url":"0e30abd4-5031-44fe-a5ca-a343924c9f13","dynamicSize":"d2f7f695-a972-449b-a048-7ff72a9f641f","width":"b27d0cf3-9e34-4b5b-8386-a802e1f5f647","height":"54c167f1-2336-4881-b200-bd7df2f99bfe","playFromBeginning":"2bee441e-45a8-42d2-ab2d-897d2a3cfdef","startingTime":"83fd259e-6d29-4750-b4c2-b7e066bf8af8"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"61d9d55a-1fe3-4e93-959c-107552e8f1d6"}}]}]}]]>
From e46ea8db24e5eea5979676ffbcf77d4c8d81faa1 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 21 Nov 2024 14:34:27 -0500 Subject: [PATCH 48/60] GH-69 :: fix missing page urls for spanish in articles --- .../es_news_about-confiers_es@2b1f181ab1.xml | 31 +++++++++++++++++ ...intervi..-little-bo-peep_es@a8e42c6a79.xml | 31 +++++++++++++++++ ...n-plant..with-jack-trott_es@2170a2db0e.xml | 33 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_news_about-confiers_es@2b1f181ab1.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_news_about-confiers_es@2b1f181ab1.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_news_about-confiers_es@2b1f181ab1.xml new file mode 100644 index 00000000..985185b1 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_news_about-confiers_es@2b1f181ab1.xml @@ -0,0 +1,31 @@ + + + es/News/About-confiers + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 25add121-e097-49c3-87cc-132d056ba8c2 + + + + True + False + True + 0 + + AboutConfiers-43kzvzza + 0c82ddd0-c520-4bb8-9692-56b59b82e667 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml new file mode 100644 index 00000000..5d396fe9 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml @@ -0,0 +1,31 @@ + + + es/News/An-interview-with-Little-Bo-Peep + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + b4203823-e746-4513-bc00-fa5546abdc06 + + + + True + False + True + 0 + + AnInterviewWithLittleBo-Peep-jnv3k9yl + 6b46e6ea-503e-40a6-8d8d-4dd101914ecf + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml new file mode 100644 index 00000000..bba66f2b --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml @@ -0,0 +1,33 @@ + + + + + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 25ea6bb6-bd9e-44e7-8c5d-8356d7dc8a5d + + + + True + False + True + 0 + + BeanPlantCultivation_AnInterviewWithJackTrott-r2dn92hl + d980ca3e-a737-4025-88ad-2ed561c0f3da + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file From bb5582966286b2f81b451e39feedb006ed4890c1 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 21 Nov 2024 15:24:41 -0500 Subject: [PATCH 49/60] GH-69 :: Fix spanish URL paths for CI copied articles --- ...8-449f-8ac1-1daa9f2789ab_en@44d4f48f5c.xml | 2 +- ...9-47a3-b8f7-aad24f17dcec_en@bf1370ad95.xml | 2 +- .../news_about-confiers_en@df4aa49d94.xml | 26 +++++++++++++++++++ ...s_newses_about-conifers_es@2b1f181ab1.xml} | 4 +-- ... => news_about-conifers_en@a0759b5f1b.xml} | 4 +-- ...-inter..-little-bo-peep_es@a8e42c6a79.xml} | 4 +-- ...an-pla..with-jack-trott_es@2170a2db0e.xml} | 4 +-- 7 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/news_about_confiers@026d2f7cc2/news_about-confiers_en@df4aa49d94.xml rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/{es_news_about-confiers_es@2b1f181ab1.xml => es_newses_about-conifers_es@2b1f181ab1.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/{news_about-confiers_en@a0759b5f1b.xml => news_about-conifers_en@a0759b5f1b.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/{es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml => es_newses_an-inter..-little-bo-peep_es@a8e42c6a79.xml} (88%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/{es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml => es_newses_bean-pla..with-jack-trott_es@2170a2db0e.xml} (88%) diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/aboutconfiers-43kzvzza@0caafdb33d/cbc24ca3-4a18-449f-8ac1-1daa9f2789ab_en@44d4f48f5c.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/aboutconfiers-43kzvzza@0caafdb33d/cbc24ca3-4a18-449f-8ac1-1daa9f2789ab_en@44d4f48f5c.xml index 95c98dca..15a14dff 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/aboutconfiers-43kzvzza@0caafdb33d/cbc24ca3-4a18-449f-8ac1-1daa9f2789ab_en@44d4f48f5c.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/aboutconfiers-43kzvzza@0caafdb33d/cbc24ca3-4a18-449f-8ac1-1daa9f2789ab_en@44d4f48f5c.xml @@ -13,7 +13,7 @@ 2024-08-27 15:07:31Z cbc24ca3-4a18-449f-8ac1-1daa9f2789ab True - 2024-08-27 15:07:31Z + 2024-11-21 20:17:48Z diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/aboutconfiers-43kzvzza@0caafdb33d/36e02e85-63b9-47a3-b8f7-aad24f17dcec_en@bf1370ad95.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/aboutconfiers-43kzvzza@0caafdb33d/36e02e85-63b9-47a3-b8f7-aad24f17dcec_en@bf1370ad95.xml index 16c5df8b..a6527fce 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/aboutconfiers-43kzvzza@0caafdb33d/36e02e85-63b9-47a3-b8f7-aad24f17dcec_en@bf1370ad95.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/aboutconfiers-43kzvzza@0caafdb33d/36e02e85-63b9-47a3-b8f7-aad24f17dcec_en@bf1370ad95.xml @@ -16,7 +16,7 @@ cms.user 2024-08-27 15:07:28Z - About confiers + About conifers 36e02e85-63b9-47a3-b8f7-aad24f17dcec False 2 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/news_about_confiers@026d2f7cc2/news_about-confiers_en@df4aa49d94.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/news_about_confiers@026d2f7cc2/news_about-confiers_en@df4aa49d94.xml new file mode 100644 index 00000000..bef3943e --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/news_about_confiers@026d2f7cc2/news_about-confiers_en@df4aa49d94.xml @@ -0,0 +1,26 @@ + + + News/About-confiers + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + + + + AboutConfiers-43kzvzza + 0c82ddd0-c520-4bb8-9692-56b59b82e667 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_news_about-confiers_es@2b1f181ab1.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_newses_about-conifers_es@2b1f181ab1.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_news_about-confiers_es@2b1f181ab1.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_newses_about-conifers_es@2b1f181ab1.xml index 985185b1..a37286e7 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_news_about-confiers_es@2b1f181ab1.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/es_newses_about-conifers_es@2b1f181ab1.xml @@ -1,6 +1,6 @@  - es/News/About-confiers + es/NewsES/About-conifers es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ 25add121-e097-49c3-87cc-132d056ba8c2 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/news_about-confiers_en@a0759b5f1b.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/news_about-conifers_en@a0759b5f1b.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/news_about-confiers_en@a0759b5f1b.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/news_about-conifers_en@a0759b5f1b.xml index d8aca50e..6a966fd9 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/news_about-confiers_en@a0759b5f1b.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_about_confiers@026d2f7cc2/news_about-conifers_en@a0759b5f1b.xml @@ -1,6 +1,6 @@  - News/About-confiers + News/About-conifers en e81b5172-f240-4041-88b1-653089984e29 @@ -8,7 +8,7 @@ 9e9da690-8c9a-4173-a6d7-5ab2f71fa8f2 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_newses_an-inter..-little-bo-peep_es@a8e42c6a79.xml similarity index 88% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_newses_an-inter..-little-bo-peep_es@a8e42c6a79.xml index 5d396fe9..0d0af03b 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_news_an-intervi..-little-bo-peep_es@a8e42c6a79.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_an_interview_with_little_bo-peep@2bf29f32fd/es_newses_an-inter..-little-bo-peep_es@a8e42c6a79.xml @@ -1,6 +1,6 @@  - es/News/An-interview-with-Little-Bo-Peep + es/NewsES/An-interview-with-Little-Bo-Peep es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ b4203823-e746-4513-bc00-fa5546abdc06 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_newses_bean-pla..with-jack-trott_es@2170a2db0e.xml similarity index 88% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_newses_bean-pla..with-jack-trott_es@2170a2db0e.xml index bba66f2b..3a8d9aa6 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_news_bean-plant..with-jack-trott_es@2170a2db0e.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/news_bean_plant_cu..iew_with_jack_trot@b68ef64723/es_newses_bean-pla..with-jack-trott_es@2170a2db0e.xml @@ -1,7 +1,7 @@  - + es @@ -10,7 +10,7 @@ 25ea6bb6-bd9e-44e7-8c5d-8356d7dc8a5d - + True False From 8d36270ff7b05add3a10d22bb924068f727fe62a Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 21 Nov 2024 15:41:16 -0500 Subject: [PATCH 50/60] GH-90 :: Add secured checks to content querying, adjust url retrieval in article page service --- .../Articles/Services/ArticlePageService.cs | 4 +- .../Services/ContentItemRetrieverService.cs | 53 ++++++++++++++----- .../Services/IContentItemRetrieverService.cs | 13 +++-- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs b/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs index 3ab4ec11..ef0f7799 100644 --- a/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs +++ b/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs @@ -33,7 +33,7 @@ public async Task GetArticlePageViewModel(ArticlePage? art return new ArticlePageViewModel(); } - string articleUrl = (await webPageUrlRetriever.Retrieve(articlePage.SystemFields.WebPageItemGUID, preferredLanguageRetriever.Get())).RelativePath; + string articleUrl = (await webPageUrlRetriever.Retrieve(articlePage, preferredLanguageRetriever.Get())).RelativePath; var articleSchema = articlePage.ArticlePageArticleContent.FirstOrDefault(); if (articleSchema != null) @@ -80,7 +80,7 @@ public async Task GetArticlePageViewModelWithSecurity(Arti { string signInUrl = await membershipService.GetSignInUrl(preferredLanguageRetriever.Get()); - string signInUrlWithReturn = signInUrl + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, originalViewModel.Url).ToString(); + string signInUrlWithReturn = signInUrl + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, originalViewModel.Url.Replace("~", "")).ToString(); return new ArticlePageViewModel { diff --git a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs index 6b0c7625..4cc89889 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs @@ -69,7 +69,8 @@ public ContentItemRetrieverService( /// An enumerable set of items public async Task> RetrieveWebPageContentItems( string contentTypeName, - Func queryFilter) + Func queryFilter, + bool includeSecuredItems = true) { var builder = new ContentItemQueryBuilder() .ForContentType( @@ -81,7 +82,8 @@ public async Task> RetrieveWebPageContentItems( var queryExecutorOptions = new ContentQueryExecutionOptions { - ForPreview = webSiteChannelContext.IsPreview + ForPreview = webSiteChannelContext.IsPreview, + IncludeSecuredItems = includeSecuredItems }; var pages = await contentQueryExecutor.GetMappedWebPageResult(builder, queryExecutorOptions); @@ -159,7 +161,8 @@ public async Task> RetrieveWebPageChildrenByPathAndReference( /// An enumerable set of items public async Task> RetrieveReusableContentItems( string contentTypeName, - Func queryFilter) + Func queryFilter, + bool includeSecuredItems = true) { var builder = new ContentItemQueryBuilder() .ForContentType( @@ -170,7 +173,8 @@ public async Task> RetrieveReusableContentItems( var queryExecutorOptions = new ContentQueryExecutionOptions { - ForPreview = webSiteChannelContext.IsPreview + ForPreview = webSiteChannelContext.IsPreview, + IncludeSecuredItems = includeSecuredItems }; var items = await contentQueryExecutor.GetMappedResult(builder, queryExecutorOptions); @@ -217,25 +221,32 @@ private async Task> RetrieveWebPageChildrenByPath( public class ContentItemRetrieverService : IContentItemRetrieverService { private readonly IContentQueryExecutor contentQueryExecutor; - private readonly IWebsiteChannelContext websiteChannelContext; + private readonly IWebsiteChannelContext webSiteChannelContext; public ContentItemRetrieverService( IContentQueryExecutor contentQueryExecutor, - IWebsiteChannelContext websiteChannelContext) + IWebsiteChannelContext webSiteChannelContext) { this.contentQueryExecutor = contentQueryExecutor; - this.websiteChannelContext = websiteChannelContext; + this.webSiteChannelContext = webSiteChannelContext; } private async Task> RetrieveContentItems(Action contentQueryParameters, - Action contentTypesQueryParameters) + Action contentTypesQueryParameters, + bool includeSecuredItems = true) { var builder = new ContentItemQueryBuilder(); builder.ForContentTypes(contentTypesQueryParameters) .Parameters(contentQueryParameters); - return await contentQueryExecutor.GetMappedResult(builder); + var queryExecutorOptions = new ContentQueryExecutionOptions + { + ForPreview = webSiteChannelContext.IsPreview, + IncludeSecuredItems = includeSecuredItems + }; + + return await contentQueryExecutor.GetMappedResult(builder, queryExecutorOptions); } /// @@ -256,18 +267,25 @@ public async Task> RetrieveContentItemsByS return await RetrieveContentItems(contentQueryParameters, contentTypesQueryParameters); } - private async Task> RetrieveWebPages(Action parameters) + private async Task> RetrieveWebPages(Action parameters, + bool includeSecuredItems = true) { var builder = new ContentItemQueryBuilder(); builder .ForContentTypes(query => { - query.ForWebsite(websiteChannelContext.WebsiteChannelName); + query.ForWebsite(webSiteChannelContext.WebsiteChannelName); }) .Parameters(parameters); - return await contentQueryExecutor.GetMappedResult(builder); + var queryExecutorOptions = new ContentQueryExecutionOptions + { + ForPreview = webSiteChannelContext.IsPreview, + IncludeSecuredItems = includeSecuredItems + }; + + return await contentQueryExecutor.GetMappedResult(builder, queryExecutorOptions); } /// @@ -307,15 +325,22 @@ private async Task> RetrieveWebPages(Action /// the path of the web page item /// object containing generic for the item - public async Task RetrieveWebPageByPath(string pathToMatch) + public async Task RetrieveWebPageByPath(string pathToMatch, + bool includeSecuredItems = true) { var builder = new ContentItemQueryBuilder(); builder.ForContentTypes(query => { - query.ForWebsite(websiteChannelContext.WebsiteChannelName, PathMatch.Single(pathToMatch)); + query.ForWebsite(webSiteChannelContext.WebsiteChannelName, PathMatch.Single(pathToMatch)); }); + var queryExecutorOptions = new ContentQueryExecutionOptions + { + ForPreview = webSiteChannelContext.IsPreview, + IncludeSecuredItems = includeSecuredItems + }; + var pages = await contentQueryExecutor.GetMappedResult(builder); return pages.FirstOrDefault(); diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs index 49636b20..f2dedd99 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IContentItemRetrieverService.cs @@ -13,12 +13,13 @@ public interface IContentItemRetrieverService int depth = 1); public Task> RetrieveWebPageContentItems(string contentTypeName, - Func queryFilter); + Func queryFilter, + bool includeSecuredItems = true); public Task> RetrieveWebPageChildrenByPath( string parentPageContentTypeName, string path, - bool includeSecuredItems, + bool includeSecuredItems = true, int depth = 1); public Task> RetrieveWebPageChildrenByPathAndReference( @@ -26,7 +27,7 @@ public Task> RetrieveWebPageChildrenByPathAndReference( string parentPagePath, string referenceFieldName, IEnumerable referenceIds, - bool includeSecuredItems, + bool includeSecuredItems = true, int depth = 1 ); @@ -37,7 +38,8 @@ public Task> RetrieveWebPageChildrenByPathAndReference( public Task> RetrieveReusableContentItems( string contentTypeName, - Func queryFilter); + Func queryFilter, + bool includeSecuredItems = true); } public interface IContentItemRetrieverService @@ -50,5 +52,6 @@ public Task> RetrieveContentItemsBySchemaA string schemaName, string taxonomyColumnName, IEnumerable tagGuids); - public Task RetrieveWebPageByPath(string pathToMatch); + public Task RetrieveWebPageByPath(string pathToMatch, + bool includeSecuredItems = true); } \ No newline at end of file From a4c4e50573766c844d194fd76bc9f4a2bc1af7ae Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Thu, 21 Nov 2024 15:54:35 -0500 Subject: [PATCH 51/60] GH-90 :: add translations, small refactor on sign in prompt --- .../Features/Articles/Services/ArticlePageService.cs | 5 +++-- src/TrainingGuides.Web/Resources/SharedResources.es.resx | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs b/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs index ef0f7799..d97bf11a 100644 --- a/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs +++ b/src/TrainingGuides.Web/Features/Articles/Services/ArticlePageService.cs @@ -82,11 +82,12 @@ public async Task GetArticlePageViewModelWithSecurity(Arti string signInUrlWithReturn = signInUrl + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, originalViewModel.Url.Replace("~", "")).ToString(); + var message = new HtmlString(stringLocalizer["Sign in to view this content."]); return new ArticlePageViewModel { Title = $"{stringLocalizer["(🔒 Locked)"]} {originalViewModel.Title}", - Summary = new HtmlString(stringLocalizer["Sign in to view this content."]), - Text = new HtmlString(stringLocalizer["Sign in to view this content."]), + Summary = message, + Text = message, CreatedOn = articlePage.ArticlePagePublishDate, TeaserImage = originalViewModel.TeaserImage, Url = signInUrlWithReturn diff --git a/src/TrainingGuides.Web/Resources/SharedResources.es.resx b/src/TrainingGuides.Web/Resources/SharedResources.es.resx index c199c514..759f4044 100644 --- a/src/TrainingGuides.Web/Resources/SharedResources.es.resx +++ b/src/TrainingGuides.Web/Resources/SharedResources.es.resx @@ -165,4 +165,10 @@ Error en el registro. + + (🔒 Bloqueada) + + + Inicie sesión para ver este contenido. + \ No newline at end of file From 53e3e56ec60702512fb7589cd4889cd11a35d62b Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Mon, 25 Nov 2024 16:56:22 -0500 Subject: [PATCH 52/60] GH-92 :: initial code for reset password functionality, --- .../RegistrationWidgetViewComponentTests.cs | 8 +- .../resetpassword-bt12pytq.xml | 17 ++ ...5-4666-9502-80083879519a_en@1757274891.xml | 2 +- ...9-40e5-bb2d-0cef367a0a4a_en@605f6d80bd.xml | 24 +++ ...0-4e48-bbf0-b3b5dc4e32ca_es@157b66a4cb.xml | 24 +++ ...4-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml | 4 +- ...a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml | 4 +- ...c-47a0-b6e0-31d99517adaa_es@f9912c38d5.xml | 30 +++ ...4-4cb6-aa05-6e3012d80701_en@6b8252169f.xml | 28 +++ .../cms.webpageitem/contact_us@3a24980ea3.xml | 2 +- .../cookie_policy@fdaf70dc83.xml | 2 +- .../cms.webpageitem/home@0b99586e43.xml | 2 +- .../cms.webpageitem/news@8a4426a4c0.xml | 2 +- .../policy_downloads@fb51445f65.xml | 2 +- .../cms.webpageitem/products@e200480d67.xml | 2 +- .../reset_password@81a545c638.xml | 21 ++ .../cms.webpageitem/sign_in@97331a9071.xml | 2 +- .../widget_samples@8227dadc40.xml | 2 +- ...s_restablecer-contrasena_es@24de890c01.xml | 31 +++ .../reset-password_en@1ee3346e0e.xml | 31 +++ .../0b7ea4fd-0110-492e-9313-51b61b49bb90.xml | 13 ++ .../4c949a12-1177-44c7-8e95-f645d261dc08.xml | 13 ++ .../Controllers/AuthenticationController.cs | 17 +- .../Controllers/MemberManagementController.cs | 191 ++++++++++++++++++ .../Controllers/RegistrationController.cs | 2 +- .../Membership/Services/IMembershipService.cs | 24 +++ .../Membership/Services/MembershipService.cs | 15 ++ .../Registration/EmailConfirmation.cshtml | 120 ++++------- .../ResetPassword/ResetPassword.cshtml | 38 ++++ .../ResetPassword/ResetPasswordForm.cshtml | 34 ++++ .../ResetPasswordRequestForm.cshtml | 25 +++ .../ResetPassword/ResetPasswordViewModel.cs | 59 ++++++ .../ResetPassword/ResetPasswordWidget.cshtml | 30 +++ .../ResetPasswordWidgetProperties.cs | 26 +++ .../ResetPasswordWidgetViewComponent.cs | 44 ++++ .../ResetPasswordWidgetViewModel.cs | 37 ++++ .../Shared/Helpers/ApplicationConstants.cs | 5 +- src/TrainingGuides.Web/Program.cs | 11 +- .../Views/Shared/_UtilityPageLayout.cshtml | 39 ++++ 39 files changed, 875 insertions(+), 108 deletions(-) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/resetpassword-bt12pytq.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/6cbe3402-59b9-40e5-bb2d-0cef367a0a4a_en@605f6d80bd.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/8e25b79b-1a70-4e48-bbf0-b3b5dc4e32ca_es@157b66a4cb.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/46b7f9b0-3c4c-47a0-b6e0-31d99517adaa_es@f9912c38d5.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/a70988d8-cfc4-4cb6-aa05-6e3012d80701_en@6b8252169f.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..2d-0cef367a0a4a_en@d5d6087785/0b7ea4fd-0110-492e-9313-51b61b49bb90.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..f0-b3b5dc4e32ca_es@5fb267870b/4c949a12-1177-44c7-8e95-f645d261dc08.xml create mode 100644 src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPassword.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordForm.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordRequestForm.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidget.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetProperties.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewComponent.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs create mode 100644 src/TrainingGuides.Web/Views/Shared/_UtilityPageLayout.cshtml diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs index 03a00384..297d8ba0 100644 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/Registration/RegistrationWidgetViewComponentTests.cs @@ -1,3 +1,4 @@ +using Kentico.Content.Web.Mvc.Routing; using Moq; using TrainingGuides.Web.Features.Membership.Services; using TrainingGuides.Web.Features.Membership.Widgets.Registration; @@ -10,6 +11,7 @@ public class RegistrationWidgetViewComponentTests private readonly RegistrationWidgetViewComponent viewComponent; private readonly Mock httpRequestServiceMock; private readonly Mock membershipServiceMock; + private readonly Mock preferredLanguageRetrieverMock; private readonly RegistrationWidgetProperties referenceProperties; private const string FORM_TITLE = "Register"; @@ -27,12 +29,16 @@ public class RegistrationWidgetViewComponentTests public RegistrationWidgetViewComponentTests() { httpRequestServiceMock = new Mock(); + httpRequestServiceMock.Setup(x => x.GetBaseUrlWithLanguage()).Returns(BASE_URL); httpRequestServiceMock.Setup(x => x.GetBaseUrl()).Returns(BASE_URL); + preferredLanguageRetrieverMock = new Mock(); + preferredLanguageRetrieverMock.Setup(x => x.Get()).Returns("en"); + membershipServiceMock = new Mock(); membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); - viewComponent = new RegistrationWidgetViewComponent(httpRequestServiceMock.Object, membershipServiceMock.Object); + viewComponent = new RegistrationWidgetViewComponent(httpRequestServiceMock.Object, membershipServiceMock.Object, preferredLanguageRetrieverMock.Object); referenceProperties = new RegistrationWidgetProperties() { diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/resetpassword-bt12pytq.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/resetpassword-bt12pytq.xml new file mode 100644 index 00000000..68b909d4 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/resetpassword-bt12pytq.xml @@ -0,0 +1,17 @@ + + + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + TrainingGuides.EmptyPage + 58018c9d-5b6c-4251-b3a8-8c1a6d124780 + cms.contenttype + + 58013402-ea45-4554-ab22-4bb27243b0ce + False + False + ResetPassword-bt12pytq + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml index baf48eed..f108da39 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/news-bgt05j82@51846c04e6/81c6968d-ccf5-4666-9502-80083879519a_en@1757274891.xml @@ -12,7 +12,7 @@ 81c6968d-ccf5-4666-9502-80083879519a True - 2024-11-20 21:33:49Z + 2024-11-25 19:05:52Z diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/6cbe3402-59b9-40e5-bb2d-0cef367a0a4a_en@605f6d80bd.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/6cbe3402-59b9-40e5-bb2d-0cef367a0a4a_en@605f6d80bd.xml new file mode 100644 index 00000000..a59fd72c --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/6cbe3402-59b9-40e5-bb2d-0cef367a0a4a_en@605f6d80bd.xml @@ -0,0 +1,24 @@ + + + + ResetPassword-bt12pytq + 58013402-ea45-4554-ab22-4bb27243b0ce + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + 2024-11-25 19:07:31Z + 6cbe3402-59b9-40e5-bb2d-0cef367a0a4a + True + 2024-11-25 19:07:31Z + + Reset your password"},"fieldIdentifiers":{"content":"51a00613-f344-4ac0-aec8-5279713cc336"}}]},{"identifier":"458f4228-031c-474b-970b-d6fa09a2d8fa","type":"TrainingGuides.ResetPasswordWidget","variants":[{"identifier":"4fc42ea0-16bc-43bc-bef2-12eae0ee2a6b","properties":{"emailAddressLabel":"Email address","submitButtonText":"Submit"},"fieldIdentifiers":{"emailAddressLabel":"17205ba4-7ed7-4d50-818f-a599d5124bb9","submitButtonText":"2d188f52-5ab1-422f-a556-ed529ff74088"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"480d9308-4e58-4f82-bb84-7097ebe08422","colorScheme":"7a4bd8ad-1172-4a4e-89f8-cda5754a7415","cornerStyle":"8d550676-fe66-4dd2-8f3e-9ff5b36c2195","columnLayout":"9e1aeee8-fdd3-4b2a-8fd6-29827a6dadc2"}}]}]}]]> + + + + + 2 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/8e25b79b-1a70-4e48-bbf0-b3b5dc4e32ca_es@157b66a4cb.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/8e25b79b-1a70-4e48-bbf0-b3b5dc4e32ca_es@157b66a4cb.xml new file mode 100644 index 00000000..ad20bd49 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/resetpassword-bt12pytq@637f5ba208/8e25b79b-1a70-4e48-bbf0-b3b5dc4e32ca_es@157b66a4cb.xml @@ -0,0 +1,24 @@ + + + + ResetPassword-bt12pytq + 58013402-ea45-4554-ab22-4bb27243b0ce + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 2024-11-25 19:10:14Z + 8e25b79b-1a70-4e48-bbf0-b3b5dc4e32ca + True + 2024-11-25 19:10:14Z + + Restablece su contraseña"},"fieldIdentifiers":{"content":"51a00613-f344-4ac0-aec8-5279713cc336"}}]},{"identifier":"458f4228-031c-474b-970b-d6fa09a2d8fa","type":"TrainingGuides.ResetPasswordWidget","variants":[{"identifier":"4fc42ea0-16bc-43bc-bef2-12eae0ee2a6b","properties":{"emailAddressLabel":"Email","submitButtonText":"Enviar"},"fieldIdentifiers":{"emailAddressLabel":"17205ba4-7ed7-4d50-818f-a599d5124bb9","submitButtonText":"2d188f52-5ab1-422f-a556-ed529ff74088"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"480d9308-4e58-4f82-bb84-7097ebe08422","colorScheme":"7a4bd8ad-1172-4a4e-89f8-cda5754a7415","cornerStyle":"8d550676-fe66-4dd2-8f3e-9ff5b36c2195","columnLayout":"9e1aeee8-fdd3-4b2a-8fd6-29827a6dadc2"}}]}]}]]> + + + + + 2 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml index 99d64647..4ce95d11 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/46487f03-5214-475f-8a76-57c4fa27c1f7_en@c5ccec578d.xml @@ -13,9 +13,9 @@ 2024-11-12 21:09:53Z 46487f03-5214-475f-8a76-57c4fa27c1f7 True - 2024-11-15 20:21:12Z + 2024-11-25 19:11:42Z - + diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml index 6bc8aa57..b3aeb5e4 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/signin-x4a1nygh@e4708c2853/c9c07ec5-c40a-4a78-89eb-09c9d2f08f05_es@6b52f5dc41.xml @@ -13,9 +13,9 @@ 2024-11-14 20:48:13Z c9c07ec5-c40a-4a78-89eb-09c9d2f08f05 True - 2024-11-15 20:21:31Z + 2024-11-25 19:12:32Z - + diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/46b7f9b0-3c4c-47a0-b6e0-31d99517adaa_es@f9912c38d5.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/46b7f9b0-3c4c-47a0-b6e0-31d99517adaa_es@f9912c38d5.xml new file mode 100644 index 00000000..487dd0bf --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/46b7f9b0-3c4c-47a0-b6e0-31d99517adaa_es@f9912c38d5.xml @@ -0,0 +1,30 @@ + + + + ResetPassword-bt12pytq + 58013402-ea45-4554-ab22-4bb27243b0ce + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-25 19:09:09Z + + + + 46b7f9b0-3c4c-47a0-b6e0-31d99517adaa + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/a70988d8-cfc4-4cb6-aa05-6e3012d80701_en@6b8252169f.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/a70988d8-cfc4-4cb6-aa05-6e3012d80701_en@6b8252169f.xml new file mode 100644 index 00000000..d32d33d4 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/resetpassword-bt12pytq@637f5ba208/a70988d8-cfc4-4cb6-aa05-6e3012d80701_en@6b8252169f.xml @@ -0,0 +1,28 @@ + + + + ResetPassword-bt12pytq + 58013402-ea45-4554-ab22-4bb27243b0ce + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-25 19:05:14Z + Reset password + a70988d8-cfc4-4cb6-aa05-6e3012d80701 + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml index 5361361d..e9d03ac5 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml @@ -7,7 +7,7 @@ 4f7e84c7-329f-413e-83d9-5923a1011ccb ContactUs-2zqcdint - 8 + 7 /Contact_us fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml index c4f77c88..6af2d5ec 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml @@ -7,7 +7,7 @@ 771d069e-e136-4a0f-880a-c0af6c8d2bdf CookiePolicy-gai183um - 9 + 8 /Cookie_policy fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml index b222c233..745a6307 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml @@ -7,7 +7,7 @@ 377ca7c4-eea9-49a0-9d58-282b5127c7ff Home-ciuaqx9l - 2 + 3 /Home fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml index 75ded986..bdcc3ff5 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml @@ -7,7 +7,7 @@ 77c7aa1f-e0e3-4b74-a66f-8c0c87523c15 News-bgt05j82 - 6 + 5 /News fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml index fb06809c..f6fdbfab 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml @@ -7,7 +7,7 @@ 72a7df0f-c50e-42a9-a8d6-931688caca7d PolicyDownloads-jazqmswu - 7 + 6 /Policy_downloads fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml index 0004ca23..a159e886 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml @@ -7,7 +7,7 @@ 5a0c83e1-2ad8-40b2-aa00-d01980daf01d Products-oypi95ub - 3 + 4 /Products fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml new file mode 100644 index 00000000..d22b8c1b --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml @@ -0,0 +1,21 @@ + + + + ResetPassword-bt12pytq + 58013402-ea45-4554-ab22-4bb27243b0ce + cms.contentitem + + 87a87bf7-17b0-403d-b751-d06dc1b64daa + ResetPassword-bt12pytq + 12 + /Reset_password + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml index 6edf3d48..9e466855 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml @@ -7,7 +7,7 @@ 18fe09dc-c0f3-4136-863f-db59732e3658 SignIn-x4a1nygh - 1 + 10 /Sign_in fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml index 18a2b22e..b4f717b6 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml @@ -7,7 +7,7 @@ dc747040-b424-4f3d-9383-5f651b96415b WidgetSamples-qyagaxb2 - 10 + 9 /Widget_samples fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml new file mode 100644 index 00000000..80c4a186 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml @@ -0,0 +1,31 @@ + + + es/Restablecer-contrasena + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + bb1216d6-6453-4336-be03-52ef7e740319 + + + + True + False + True + 0 + + ResetPassword-bt12pytq + 87a87bf7-17b0-403d-b751-d06dc1b64daa + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml new file mode 100644 index 00000000..383562f7 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml @@ -0,0 +1,31 @@ + + + Reset-password + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + b5552221-6c08-417b-9210-9bd386c2f89f + + + + True + False + True + 0 + + ResetPassword-bt12pytq + 87a87bf7-17b0-403d-b751-d06dc1b64daa + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..2d-0cef367a0a4a_en@d5d6087785/0b7ea4fd-0110-492e-9313-51b61b49bb90.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..2d-0cef367a0a4a_en@d5d6087785/0b7ea4fd-0110-492e-9313-51b61b49bb90.xml new file mode 100644 index 00000000..9962b23b --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..2d-0cef367a0a4a_en@d5d6087785/0b7ea4fd-0110-492e-9313-51b61b49bb90.xml @@ -0,0 +1,13 @@ + + + + 6cbe3402-59b9-40e5-bb2d-0cef367a0a4a + cms.contentitemcommondata + + ResetPassword-bt12pytq + 58013402-ea45-4554-ab22-4bb27243b0ce + cms.contentitem + + + 0b7ea4fd-0110-492e-9313-51b61b49bb90 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..f0-b3b5dc4e32ca_es@5fb267870b/4c949a12-1177-44c7-8e95-f645d261dc08.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..f0-b3b5dc4e32ca_es@5fb267870b/4c949a12-1177-44c7-8e95-f645d261dc08.xml new file mode 100644 index 00000000..6c2b9292 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/resetpassword-bt12..f0-b3b5dc4e32ca_es@5fb267870b/4c949a12-1177-44c7-8e95-f645d261dc08.xml @@ -0,0 +1,13 @@ + + + + 8e25b79b-1a70-4e48-bbf0-b3b5dc4e32ca + cms.contentitemcommondata + + ResetPassword-bt12pytq + 58013402-ea45-4554-ab22-4bb27243b0ce + cms.contentitem + + + 4c949a12-1177-44c7-8e95-f645d261dc08 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index fd63fd69..422a0b14 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -4,7 +4,6 @@ using TrainingGuides.Web.Features.Membership.Widgets.SignIn; using TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; using TrainingGuides.Web.Features.Shared.Helpers; -using CMS.Websites.Routing; using Kentico.Content.Web.Mvc.Routing; using CMS.DataEngine; using CMS.ContentEngine; @@ -16,21 +15,15 @@ namespace TrainingGuides.Web.Features.Membership.Controllers; public class AuthenticationController : Controller { private readonly IMembershipService membershipService; - private readonly IWebPageUrlRetriever webPageUrlRetriever; - private readonly IWebsiteChannelContext websiteChannelContext; private readonly IPreferredLanguageRetriever preferredLanguageRetriever; private readonly IInfoProvider contentLanguageInfoProvider; private const string SIGN_IN_FAILED = "Your sign-in attempt was not successful. Please try again."; public AuthenticationController(IMembershipService membershipService, - IWebPageUrlRetriever webPageUrlRetriever, - IWebsiteChannelContext websiteChannelContext, IPreferredLanguageRetriever preferredLanguageRetriever, IInfoProvider contentLanguageInfoProvider) { this.membershipService = membershipService; - this.webPageUrlRetriever = webPageUrlRetriever; - this.websiteChannelContext = websiteChannelContext; this.preferredLanguageRetriever = preferredLanguageRetriever; this.contentLanguageInfoProvider = contentLanguageInfoProvider; } @@ -78,18 +71,14 @@ public async Task SignOut(SignOutFormModel model) return Redirect(model.RedirectUrl); } - [HttpGet(ApplicationConstants.ACCESS_DENIED_CONTROLLER_PATH)] + [HttpGet(ApplicationConstants.ACCESS_DENIED_ACTION_PATH)] public async Task AccessDenied([FromQuery(Name = ApplicationConstants.RETURN_URL_PARAMETER)] string returnUrl) { string language = GetLanguageFromReturnUrl(returnUrl); - var signInUrl = await webPageUrlRetriever.Retrieve( - webPageTreePath: ApplicationConstants.EXPECTED_SIGN_IN_PATH, - websiteChannelName: websiteChannelContext.WebsiteChannelName, - languageName: language - ); + string signInUrl = await membershipService.GetSignInUrl(language); - string redirectUrl = signInUrl.RelativePath + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, returnUrl); + string redirectUrl = signInUrl + QueryString.Create(ApplicationConstants.RETURN_URL_PARAMETER, returnUrl); return Redirect(redirectUrl); } diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs new file mode 100644 index 00000000..5f341946 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs @@ -0,0 +1,191 @@ +using System.Web; +using CMS.EmailEngine; +using Kentico.Content.Web.Mvc.Routing; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Localization; +using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; +using TrainingGuides.Web.Features.Shared.Helpers; +using TrainingGuides.Web.Features.Shared.Services; + +namespace TrainingGuides.Web.Features.Membership.Controllers; + +public class MemberManagementController : Controller +{ + private readonly IMembershipService membershipService; + private readonly IEmailService emailService; + private readonly IStringLocalizer stringLocalizer; + private readonly IHttpRequestService httpRequestService; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; + + private const string INVALID_PASSWORD_RESET_REQUEST = "Your password reset request is expired or invalid."; + + public MemberManagementController(IMembershipService membershipService, + IEmailService emailService, + IStringLocalizer stringLocalizer, + IHttpRequestService httpRequestService, + IPreferredLanguageRetriever preferredLanguageRetriever) + { + this.membershipService = membershipService; + this.emailService = emailService; + this.stringLocalizer = stringLocalizer; + this.httpRequestService = httpRequestService; + this.preferredLanguageRetriever = preferredLanguageRetriever; + } + + /// + /// Generates and sends password reset email. + /// + /// ResetPasswordViewModel containing information about the member + /// + [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.REQUEST_RESET_PASSWORD_ACTION_PATH}")] + [ValidateAntiForgeryToken] + public async Task RequestResetPassword(ResetPasswordWidgetViewModel model) + { + // Check if the model meets the requirements specified in its data annotations + if (!ModelState.IsValid) + { + return View(model); + } + + var guidesMember = await membershipService.FindMemberByEmail(model.EmailAddress); + + if (guidesMember != null) + { + string token = await membershipService.GeneratePasswordResetToken(guidesMember); + + string encodedToken = HttpUtility.UrlEncode(token); + + string encodedEmail = HttpUtility.UrlEncode(guidesMember.Email) ?? string.Empty; + + string resetUrl = $"{model.BaseUrlWithLanguage}{ApplicationConstants.PASSWORD_RESET_ACTION_PATH}/{encodedEmail}/{encodedToken}"; + + await emailService + .SendEmail(new EmailMessage() + { + From = "admin@localhost.local", + Recipients = guidesMember.Email, + Subject = stringLocalizer["Password reset request"], + Body = $"{stringLocalizer["To reset your account's password, click"]} {stringLocalizer["here"]}.

" + + $"{stringLocalizer["If you did not request a password reset, please ignore this email, and do not click the link."]}

" + + $"{stringLocalizer["You can also copy-paste the following URL into your browser:"]}

" + + resetUrl + }); + } + // Don't return different results based on whether the email exists or not - this can be used to determine valid emails. + return Content($"{stringLocalizer["Success!"]}
{stringLocalizer["If there is an account with this email address, we will send a link right away."]}"); + } + + /// + /// Displays the password reset form. + /// + /// Email address of the member to reset + /// Token generated for the provided member + /// + [HttpGet($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.PASSWORD_RESET_ACTION_PATH}/{{email}}/{{token}}")] + public async Task ResetPassword(string email, string token) + { + string error = string.Empty; + string invalid = stringLocalizer[INVALID_PASSWORD_RESET_REQUEST]; + + if (string.IsNullOrEmpty(token)) + error = invalid; + + string decodedToken = token.Replace("%2f", "/"); + string decodedEmail = HttpUtility.UrlDecode(email); + + var guidesMember = await membershipService.FindMemberByEmail(decodedEmail); + + bool memberExists = guidesMember is not null && !string.IsNullOrWhiteSpace(guidesMember.Email); + bool validToken = false; + + if (memberExists) + { + try + { + validToken = await membershipService.VerifyPasswordResetToken(guidesMember!, decodedToken); + } + catch + { + error = invalid; + } + } + else + { + error = invalid; + } + + if (!validToken) + error = invalid; + + if (!string.IsNullOrEmpty(error)) + ModelState.AddModelError(string.Empty, error); + + // If the password request is valid, displays the password reset form + var model = new ResetPasswordViewModel + { + Title = stringLocalizer["Reset password"], + BaseUrlWithLanguage = $"{httpRequestService.GetBaseUrl()}/{preferredLanguageRetriever.Get()}", + Email = guidesMember?.Email ?? string.Empty, + Token = decodedToken, + DisplayForm = memberExists && validToken, + SubmitButtonText = stringLocalizer["Submit"] + }; + + return View("~/Features/Membership/Widgets/ResetPassword/ResetPassword.cshtml", model); + + } + + [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.PASSWORD_RESET_ACTION_PATH}")] + [ValidateAntiForgeryToken] + public async Task ResetPassword(ResetPasswordViewModel model) + { + if (!ModelState.IsValid) + { + return PartialView("~/Features/Membership/Widgets/ResetPassword/ResetPasswordForm.cshtml", model); + } + + string decodedToken = model.Token.Replace("%2f", "/"); + + var guidesMember = await membershipService.FindMemberByEmail(model.Email); + + if (guidesMember != null) + { + var result = await membershipService.ResetPassword(guidesMember, decodedToken, model.Password); + + if (result.Succeeded) + { + return Content(await GetSuccessContent()); + } + else + { + foreach (var error in result.Errors) + { + ModelState.AddModelError(string.Empty, error.Description); + } + } + } + else + { + model.DisplayForm = false; + ModelState.AddModelError(string.Empty, stringLocalizer[INVALID_PASSWORD_RESET_REQUEST]); + } + + return PartialView("~/Features/Membership/Widgets/ResetPassword/ResetPasswordForm.cshtml", model); + } + + private async Task GetSuccessContent() + { + string language = preferredLanguageRetriever.Get(); + string signInUrl = await membershipService.GetSignInUrl(language); + string baseUrl = httpRequestService.GetBaseUrlWithLanguage(); + + string success = stringLocalizer["Success!"]; + string signIn = stringLocalizer["Sign in"]; + string goHome = stringLocalizer["Return to the home page"]; + + return $"
{success}
" + + $"" + + $""; + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 5c0bd8f6..9a7a32c0 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -33,7 +33,7 @@ public class RegistrationController( private readonly SystemEmailOptions systemEmailOptions = systemEmailOptions.Value; private readonly IHttpRequestService httpRequestService = httpRequestService; - [HttpPost("{" + ApplicationConstants.LANGUAGE_KEY + "}/Registration/Register")] + [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.REGISTER_ACTION_PATH}")] [ValidateAntiForgeryToken] public async Task Register(RegistrationWidgetViewModel model) { diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 50fe52ba..37561fa0 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -70,6 +70,30 @@ public interface IMembershipService /// The email confirmation token. Task GenerateEmailConfirmationToken(GuidesMember member); + /// + /// Generates a password reset token for a member. + /// + /// The member for whom to generate the token. + /// The password reset token. + Task GeneratePasswordResetToken(GuidesMember member); + + /// + /// Verifies a password reset token for a member. + /// + /// The member whose email was used for the request. + /// The token used for the request. + /// True if the token is valid. + Task VerifyPasswordResetToken(GuidesMember member, string token); + + /// + /// Resets the password of a member. + /// + /// The member whose password will be updated. + /// The token used for the request. + /// The new password. + /// The task that represents the async result of the operation, containing an IdentityResult + Task ResetPassword(GuidesMember member, string token, string newPassword); + /// /// Gets the URL of the expected sign in page in the provided language. /// diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index b4bfafeb..61406c29 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -118,6 +118,21 @@ public async Task SignOut() public async Task GenerateEmailConfirmationToken(GuidesMember member) => await userManager.GenerateEmailConfirmationTokenAsync(member); + /// + public async Task GeneratePasswordResetToken(GuidesMember member) => + await userManager.GeneratePasswordResetTokenAsync(member); + + /// + public async Task VerifyPasswordResetToken(GuidesMember member, string token) => + await userManager.VerifyUserTokenAsync(user: member, + tokenProvider: userManager.Options.Tokens.PasswordResetTokenProvider, + purpose: UserManager.ResetPasswordTokenPurpose, + token: token); + + /// + public async Task ResetPassword(GuidesMember member, string token, string password) => + await userManager.ResetPasswordAsync(member, token, password); + /// public async Task GetSignInUrl(string language) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml index 1f943a5a..a628eaf5 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml @@ -3,87 +3,55 @@ @model EmailConfirmationViewModel @{ - Layout = ""; + Layout = "~/Views/Shared/_UtilityPageLayout.cshtml"; } - - - - - +@section title { @Model.Title +} - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
-
- - - @switch(Model.State) - { - case EmailConfirmationState.SuccessConfirmed: - case EmailConfirmationState.SuccessAlreadyConfirmed: - case EmailConfirmationState.FailureNotYetConfirmed: -

@Model.Message

- - - break; - case EmailConfirmationState.FailureConfirmationFailed: -

@Model.Message

- -
- - -
- break; - case EmailConfirmationState.ConfirmationResent: - default: -

@Model.Message

- break; - } +
+
+
+
+
+ + + @switch(Model.State) + { + case EmailConfirmationState.SuccessConfirmed: + case EmailConfirmationState.SuccessAlreadyConfirmed: + case EmailConfirmationState.FailureNotYetConfirmed: +

@Model.Message

+ + -
-
+ break; + case EmailConfirmationState.FailureConfirmationFailed: +

@Model.Message

+ +
+ + +
+ break; + case EmailConfirmationState.ConfirmationResent: + default: +

@Model.Message

+ break; + }
-
+
- - - - - - \ No newline at end of file +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPassword.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPassword.cshtml new file mode 100644 index 00000000..78818c49 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPassword.cshtml @@ -0,0 +1,38 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword +@using TrainingGuides.Web.Features.Shared.Helpers + +@model ResetPasswordViewModel + +@{ + Layout = "~/Views/Shared/_UtilityPageLayout.cshtml"; + string formDivId = "resetPasswordForm"; +} + +@section title { + @Model.Title +} + +
+
+
+
+
+ +

@Model.Title

+ + @using (Html.AjaxBeginForm("MemberManagement", "ResetPassword", new AjaxOptions + { + HttpMethod = "POST", + InsertionMode = InsertionMode.Replace, + UpdateTargetId = formDivId + }, new { action = $"{Model.BaseUrlWithLanguage}{ApplicationConstants.PASSWORD_RESET_ACTION_PATH}" })) + { +
+ +
+ } +
+
+
+
+
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordForm.cshtml new file mode 100644 index 00000000..d37ba60a --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordForm.cshtml @@ -0,0 +1,34 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; +@model ResetPasswordViewModel + +
+ +
+ + + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+ +
+
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordRequestForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordRequestForm.cshtml new file mode 100644 index 00000000..69809d2f --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordRequestForm.cshtml @@ -0,0 +1,25 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; + +@model ResetPasswordWidgetViewModel + +
+
+ + + + + + +
+
+ +
+
+ + +
+
+
+ +
+
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs new file mode 100644 index 00000000..7735de95 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs @@ -0,0 +1,59 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; + +namespace TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; + +public class ResetPasswordViewModel +{ + /// + /// The Base URL of the site, with language + /// + [HiddenInput] + public string BaseUrlWithLanguage { get; set; } = string.Empty; + + /// + /// Determines whether the widget should display the form. + /// + [HiddenInput] + public bool DisplayForm { get; set; } + + /// + /// Title for the page and form. + /// + [HiddenInput] + public string Title { get; set; } = string.Empty; + + /// + /// Email address used to identify the member being reset. + /// + [HiddenInput] + public string Email { get; set; } = string.Empty; + + /// + /// Token used to verify the reset request. + /// + [HiddenInput] + public string Token { get; set; } = string.Empty; + + /// + /// Submit button text + /// + [HiddenInput] + public string SubmitButtonText { get; set; } = string.Empty; + + [DataType(DataType.Password)] + [Required()] + [DisplayName("Password")] + [MaxLength(100)] + public string Password { get; set; } = string.Empty; + + [DataType(DataType.Password)] + [Required()] + [DisplayName("Confirm your Password")] + [MaxLength(100)] + [Compare(nameof(Password))] + public string ConfirmPassword { get; set; } = string.Empty; + + +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidget.cshtml new file mode 100644 index 00000000..a351eeb5 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidget.cshtml @@ -0,0 +1,30 @@ +@using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; +@using TrainingGuides.Web.Features.Shared.Helpers + +@model ResetPasswordWidgetViewModel + +@{ + // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. + var formDivId = $"resetPasswordForm{Guid.NewGuid()}"; +} + +@if (Model == null || Model.IsMisconfigured) +{ + + + + + return; +} + +@using (Html.AjaxBeginForm("MemberManagement", "ResetPassword", new AjaxOptions +{ + HttpMethod = "POST", + InsertionMode = InsertionMode.Replace, + UpdateTargetId = formDivId +}, new { action = $"{Model.BaseUrlWithLanguage}{ApplicationConstants.REQUEST_RESET_PASSWORD_ACTION_PATH}" })) +{ +
+ +
+} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetProperties.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetProperties.cs new file mode 100644 index 00000000..25c7a74a --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetProperties.cs @@ -0,0 +1,26 @@ +using Kentico.PageBuilder.Web.Mvc; +using Kentico.Xperience.Admin.Base.FormAnnotations; + +namespace TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; + +public class ResetPasswordWidgetProperties : IWidgetProperties +{ + + /// + /// Email address label. + /// + [TextInputComponent( + Label = "Email address label", + ExplanationText = "Label for the text box where members can input their email address.", + Order = 60)] + public string EmailAddressLabel { get; set; } = "Email address"; + + /// + /// Submit button text + /// + [TextInputComponent( + Label = "Submit button text", + ExplanationText = "Text for the button that submits the reset password form.", + Order = 40)] + public string SubmitButtonText { get; set; } = "Submit"; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewComponent.cs new file mode 100644 index 00000000..fb0747ae --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewComponent.cs @@ -0,0 +1,44 @@ +using Kentico.Content.Web.Mvc.Routing; +using Kentico.PageBuilder.Web.Mvc; +using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; +using TrainingGuides.Web.Features.Shared.Services; + +[assembly: RegisterWidget( + identifier: ResetPasswordWidgetViewComponent.IDENTIFIER, + viewComponentType: typeof(ResetPasswordWidgetViewComponent), + name: "Reset password", + propertiesType: typeof(ResetPasswordWidgetProperties), + Description = "Allows members to request a reset password link.", + IconClass = "icon-key")] + +namespace TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; +public class ResetPasswordWidgetViewComponent : ViewComponent +{ + private readonly IHttpRequestService httpRequestService; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; + + public const string IDENTIFIER = "TrainingGuides.ResetPasswordWidget"; + + public ResetPasswordWidgetViewComponent(IHttpRequestService httpRequestService, + IPreferredLanguageRetriever preferredLanguageRetriever) + { + this.httpRequestService = httpRequestService; + this.preferredLanguageRetriever = preferredLanguageRetriever; + } + + public IViewComponentResult Invoke(ResetPasswordWidgetProperties properties) + { + var resetPasswordModel = BuildWidgetViewModel(properties); + return View("~/Features/Membership/Widgets/ResetPassword/ResetPasswordWidget.cshtml", resetPasswordModel); + } + + public ResetPasswordWidgetViewModel BuildWidgetViewModel(ResetPasswordWidgetProperties properties) => + new() + { + BaseUrlWithLanguage = $"{httpRequestService.GetBaseUrl()}/{preferredLanguageRetriever.Get()}", + SubmitButtonText = properties.SubmitButtonText, + EmailAddressLabel = properties.EmailAddressLabel + }; + +} diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs new file mode 100644 index 00000000..a77409cb --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs @@ -0,0 +1,37 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Shared.Models; + +namespace TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; + +public class ResetPasswordWidgetViewModel : WidgetViewModel +{ + public override bool IsMisconfigured => + string.IsNullOrWhiteSpace(BaseUrlWithLanguage) + || string.IsNullOrWhiteSpace(SubmitButtonText) + || string.IsNullOrWhiteSpace(EmailAddressLabel); + + /// + /// The Base URL of the site, with language + /// + [HiddenInput] + public string BaseUrlWithLanguage { get; set; } = string.Empty; + + /// + /// Submit button text + /// + [HiddenInput] + public string SubmitButtonText { get; set; } = string.Empty; + + /// + /// Email address label. + /// + [HiddenInput] + public string EmailAddressLabel { get; set; } = string.Empty; + + [DataType(DataType.EmailAddress)] + [Required()] + [EmailAddress()] + [MaxLength(100)] + public string EmailAddress { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs index 29928e80..11f28c2f 100644 --- a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs +++ b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs @@ -7,6 +7,9 @@ internal static class ApplicationConstants //Membership public const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; - public const string ACCESS_DENIED_CONTROLLER_PATH = "/Authentication/AccessDenied"; + public const string ACCESS_DENIED_ACTION_PATH = "/Authentication/AccessDenied"; + public const string REQUEST_RESET_PASSWORD_ACTION_PATH = "/MembershipManagement/RequestResetPassword"; + public const string PASSWORD_RESET_ACTION_PATH = "/MembershipManagement/ResetPassword"; + public const string REGISTER_ACTION_PATH = "/Registration/Register"; public const string RETURN_URL_PARAMETER = "returnUrl"; } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 0f70c781..7e46ad0c 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -93,7 +93,7 @@ builder.Services.ConfigureApplicationCookie(options => { - options.AccessDeniedPath = new PathString(ApplicationConstants.ACCESS_DENIED_CONTROLLER_PATH); + options.AccessDeniedPath = new PathString(ApplicationConstants.ACCESS_DENIED_ACTION_PATH); options.ReturnUrlParameter = ApplicationConstants.RETURN_URL_PARAMETER; }); @@ -107,7 +107,14 @@ builder.Services.AddTrainingGuidesOptions(); builder.Services.AddControllersWithViews(options => options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true); -builder.Services.AddMvc().AddMvcLocalization(); + +builder.Services.AddMvc() + .AddMvcLocalization() + .AddDataAnnotationsLocalization(options => + { + options.DataAnnotationLocalizerProvider = (type, factory) => + factory.Create(typeof(SharedResources)); + }); builder.Services.AddDistributedMemoryCache(); diff --git a/src/TrainingGuides.Web/Views/Shared/_UtilityPageLayout.cshtml b/src/TrainingGuides.Web/Views/Shared/_UtilityPageLayout.cshtml new file mode 100644 index 00000000..4adb7f9a --- /dev/null +++ b/src/TrainingGuides.Web/Views/Shared/_UtilityPageLayout.cshtml @@ -0,0 +1,39 @@ + + + + + + @RenderSection("title", required: true) + + + + + + + + + + + + + + + + + + + + +
+ +
+ @RenderBody() +
+
+ + + + + + + \ No newline at end of file From 9a71075859101a7fdfaf56684d8f4e459e7d8481 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 26 Nov 2024 11:27:39 -0500 Subject: [PATCH 53/60] GH-92 :: improvements to localization of reset password functionality --- .../Controllers/MemberManagementController.cs | 6 +-- .../Membership/Services/IMembershipService.cs | 3 +- .../Membership/Services/MembershipService.cs | 4 +- .../Shared/Services/HttpRequestService.cs | 46 ++++++++++++++++++- .../Shared/Services/IHttpRequestService.cs | 10 +++- .../Resources/SharedResources.es.resx | 31 ++++++++++++- 6 files changed, 91 insertions(+), 9 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs index 5f341946..34646b90 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs @@ -92,7 +92,7 @@ public async Task ResetPassword(string email, string token) error = invalid; string decodedToken = token.Replace("%2f", "/"); - string decodedEmail = HttpUtility.UrlDecode(email); + string decodedEmail = email.Replace("%2f", "/"); var guidesMember = await membershipService.FindMemberByEmail(decodedEmail); @@ -177,8 +177,8 @@ public async Task ResetPassword(ResetPasswordViewModel model) private async Task GetSuccessContent() { string language = preferredLanguageRetriever.Get(); - string signInUrl = await membershipService.GetSignInUrl(language); - string baseUrl = httpRequestService.GetBaseUrlWithLanguage(); + string signInUrl = await membershipService.GetSignInUrl(language, absoluteURl: true); + string baseUrl = httpRequestService.GetBaseUrlWithLanguage(checkDatabaseForDefaultLanguage: true); string success = stringLocalizer["Success!"]; string signIn = stringLocalizer["Sign in"]; diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 37561fa0..9b317f17 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -98,6 +98,7 @@ public interface IMembershipService /// Gets the URL of the expected sign in page in the provided language. ///
/// The required language to retrieve. + /// Whether to return an absolute URL. /// The relative path of the sign in page. - Task GetSignInUrl(string language); + Task GetSignInUrl(string language, bool absoluteURl = false); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 61406c29..442b5dd5 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -134,7 +134,7 @@ public async Task ResetPassword(GuidesMember member, string toke await userManager.ResetPasswordAsync(member, token, password); /// - public async Task GetSignInUrl(string language) + public async Task GetSignInUrl(string language, bool absoluteURl = false) { var signInUrl = await webPageUrlRetriever.Retrieve( webPageTreePath: ApplicationConstants.EXPECTED_SIGN_IN_PATH, @@ -142,6 +142,6 @@ public async Task GetSignInUrl(string language) languageName: language ); - return signInUrl.RelativePath; + return absoluteURl ? signInUrl.AbsoluteUrl : signInUrl.RelativePath; } } diff --git a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs index 6ee81986..7f8403a3 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/HttpRequestService.cs @@ -1,3 +1,5 @@ +using CMS.ContentEngine; +using CMS.DataEngine; using Kentico.Content.Web.Mvc; using TrainingGuides.Web.Features.Shared.Helpers; @@ -9,17 +11,21 @@ public class HttpRequestService : IHttpRequestService private readonly IHttpContextAccessor httpContextAccessor; private readonly IWebPageDataContextRetriever webPageDataContextRetriever; private readonly IWebPageUrlRetriever webPageUrlRetriever; + private readonly IInfoProvider contentLanguageInfoProvider; private const string WEB_PAGE_URL_PATHS = "Kentico.WebPageUrlPaths"; public HttpRequestService( IHttpContextAccessor httpContextAccessor, IWebPageDataContextRetriever webPageDataContextRetriever, - IWebPageUrlRetriever webPageUrlRetriever) + IWebPageUrlRetriever webPageUrlRetriever, + IInfoProvider contentLanguageInfoProvider) { this.httpContextAccessor = httpContextAccessor; this.webPageDataContextRetriever = webPageDataContextRetriever; this.webPageUrlRetriever = webPageUrlRetriever; + this.contentLanguageInfoProvider = contentLanguageInfoProvider; } + private string GetBaseUrl(HttpRequest currentRequest) { string pathBase = currentRequest.PathBase.ToString(); @@ -31,6 +37,21 @@ private string GetBaseUrl(HttpRequest currentRequest) private HttpRequest RetrieveCurrentRequest() => httpContextAccessor?.HttpContext?.Request ?? throw new NullReferenceException("Unable to retrieve current request context."); + private bool IsLanguageDefault(string language) + { + if (string.IsNullOrWhiteSpace(language)) + return true; + + var defaultLanguage = contentLanguageInfoProvider.Get() + .WhereEquals(nameof(ContentLanguageInfo.ContentLanguageIsDefault), true) + .FirstOrDefault(); + + if (defaultLanguage == null) + return true; + + return defaultLanguage.ContentLanguageName == language; + } + /// public string GetBaseUrl() { @@ -39,6 +60,7 @@ public string GetBaseUrl() } /// + /// When Kentico.WebPageUrlPaths is missing from route values, this method cannot determine the default language and falls back to default. public string GetBaseUrlWithLanguage() { var currentRequest = RetrieveCurrentRequest(); @@ -53,6 +75,28 @@ public string GetBaseUrlWithLanguage() : string.Empty); } + /// + public string GetBaseUrlWithLanguage(bool checkDatabaseForDefaultLanguage) + { + if (checkDatabaseForDefaultLanguage) + { + var currentRequest = RetrieveCurrentRequest(); + string language = (string?)currentRequest.RouteValues[ApplicationConstants.LANGUAGE_KEY] ?? string.Empty; + var webPageUrlPathList = ((string?)currentRequest.RouteValues[WEB_PAGE_URL_PATHS])?.Split('/').ToList(); + + bool notPrimaryLanguage = webPageUrlPathList?.Contains(language) ?? !IsLanguageDefault(language); + + return GetBaseUrl(currentRequest) + + (notPrimaryLanguage + ? $"/{language}" + : string.Empty); + } + else + { + return GetBaseUrlWithLanguage(); + } + } + /// public async Task GetCurrentPageUrlForLanguage(string language) { diff --git a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs index 847d6653..98048e7e 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/IHttpRequestService.cs @@ -12,9 +12,17 @@ public interface IHttpRequestService /// /// Retrieves Base URL from the current request context. If current site is in a language variant, returns language with the base URL as well /// - /// The base URL in current language variant. (e.g. website.com or website.com/es) + /// The base URL in current language variant, (e.g. website.com or website.com/es). public string GetBaseUrlWithLanguage(); + /// + /// Retrieves Base URL from the current request context. If current site is in a language variant, returns language with the base URL as well + /// + /// Determines whether to query the database for the default language when it cannot be determined from route data. + /// The base URL in current language variant. (e.g. website.com or website.com/es) + /// + public string GetBaseUrlWithLanguage(bool checkDatabaseForDefaultLanguage); + /// /// Retrieves URL of the currently displayed page for a specific language /// diff --git a/src/TrainingGuides.Web/Resources/SharedResources.es.resx b/src/TrainingGuides.Web/Resources/SharedResources.es.resx index 759f4044..a4a2e980 100644 --- a/src/TrainingGuides.Web/Resources/SharedResources.es.resx +++ b/src/TrainingGuides.Web/Resources/SharedResources.es.resx @@ -156,12 +156,38 @@ Cerrar sesión + + Restablecer contraseña + + + Enviar + ¡Éxito! - ¡Éxito! Se hemos enviado un email. Confirme su membresía haciendo clic en el enlace incluido en el correo electrónico. + ¡Éxito! Hemos enviado un email a usted. Confirme su membresía haciendo clic en el enlace incluido en el correo electrónico. + + + Su solicitud de restablecimiento de contraseña ha expirado o no es válida + + + Para restablecer la contraseña de su cuenta, haga clic + + + aquí + + Si no solicitó un restablecimiento de contraseña, ignore este email y no haga clic en el enlace. + + + También puede copiar y pegar la siguiente URL en su navegador: + + + Si hay una cuenta con esta dirección de correo electrónico, le enviaremos un enlace de inmediato. + + + Solicitud de restablecimiento de contraseña Error en el registro. @@ -171,4 +197,7 @@ Inicie sesión para ver este contenido. + + Repasar al inicio + \ No newline at end of file From 31d6a0fd767de5b1786a6e74a49a427143598698 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Tue, 26 Nov 2024 17:19:38 -0500 Subject: [PATCH 54/60] GH-93 :: initial progress on profile page --- .../ProfilePage/ProfilePage.generated.cs | 37 ++++++++++++ .../trainingguides.profilepage.xml | 20 +++++++ .../trainingguides.profilepage@80feb371fc.xml | 17 ++++++ .../ComponentIdentifiers.cs | 2 + .../ArticleList/ArticleListWidgetViewModel.cs | 4 +- .../FeaturedArticleWidgetViewModel.cs | 4 +- .../HtmlCode/HtmlCodeWidgetViewModel.cs | 4 +- .../CallToActionWidgetViewModel.cs | 4 +- .../HeroBanner/HeroBannerWidgetViewModel.cs | 4 +- .../Controllers/MemberManagementController.cs | 50 ++++++++++++++++- .../Profile/GuidesMemberProfileViewModel.cs | 25 +++++++++ .../Profile/IUpdateProfileService.cs | 11 ++++ .../Profile/ProfilePageController.cs | 14 +++++ .../Profile/ProfilePagePageTemplate.cs | 16 ++++++ .../Membership/Profile/UpdateProfile.cshtml | 22 ++++++++ .../Profile/UpdateProfileForm.cshtml | 56 +++++++++++++++++++ .../Profile/UpdateProfileService.cs | 38 +++++++++++++ .../Profile/UpdateProfileViewComponent.cs | 40 +++++++++++++ .../Profile/UpdateProfileViewModel.cs | 22 ++++++++ .../Membership/Services/IMembershipService.cs | 16 ++++++ .../Membership/Services/MembershipService.cs | 25 +++++++++ .../LinkOrSignOutWidgetViewModel.cs | 4 +- .../RegistrationWidgetViewModel.cs | 19 +------ .../ResetPasswordWidgetViewModel.cs | 4 +- .../Widgets/SignIn/SignInWidgetViewModel.cs | 4 +- .../Widgets/Product/ProductWidgetViewModel.cs | 4 +- .../ProductComparatorWidgetViewModel.cs | 4 +- .../Shared/Helpers/ApplicationConstants.cs | 1 + ...WidgetViewModel.cs => IWidgetViewModel.cs} | 2 +- .../Resources/SharedResources.es.resx | 26 ++++++++- 30 files changed, 456 insertions(+), 43 deletions(-) create mode 100644 src/TrainingGuides.Entities/PageContentTypes/ProfilePage/ProfilePage.generated.cs create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttype/trainingguides.profilepage.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttypechannel/trainingguides.profilepage@80feb371fc.xml create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/GuidesMemberProfileViewModel.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/IUpdateProfileService.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/ProfilePageController.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs rename src/TrainingGuides.Web/Features/Shared/Models/{WidgetViewModel.cs => IWidgetViewModel.cs} (74%) diff --git a/src/TrainingGuides.Entities/PageContentTypes/ProfilePage/ProfilePage.generated.cs b/src/TrainingGuides.Entities/PageContentTypes/ProfilePage/ProfilePage.generated.cs new file mode 100644 index 00000000..79a123a9 --- /dev/null +++ b/src/TrainingGuides.Entities/PageContentTypes/ProfilePage/ProfilePage.generated.cs @@ -0,0 +1,37 @@ +//-------------------------------------------------------------------------------------------------- +// +// +// This code was generated by code generator tool. +// +// To customize the code use your own partial class. For more info about how to use and customize +// the generated code see the documentation at https://docs.xperience.io/. +// +// +//-------------------------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using CMS.ContentEngine; +using CMS.Websites; + +namespace TrainingGuides +{ + /// + /// Represents a page of type . + /// + [RegisterContentTypeMapping(CONTENT_TYPE_NAME)] + public partial class ProfilePage : IWebPageFieldsSource + { + /// + /// Code name of the content type. + /// + public const string CONTENT_TYPE_NAME = "TrainingGuides.ProfilePage"; + + + /// + /// Represents system properties for a web page item. + /// + [SystemField] + public WebPageFields SystemFields { get; set; } + } +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttype/trainingguides.profilepage.xml b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttype/trainingguides.profilepage.xml new file mode 100644 index 00000000..3d589c53 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttype/trainingguides.profilepage.xml @@ -0,0 +1,20 @@ + + + Website + ProfilePage + +
+ + + + +
+ d1a0f27c-fb65-463d-8ebd-5bbbb00866f8 + False + xp-personalisation + TrainingGuides.ProfilePage + TrainingGuidesProfilePage + TrainingGuides_ProfilePage + Content + True +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttypechannel/trainingguides.profilepage@80feb371fc.xml b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttypechannel/trainingguides.profilepage@80feb371fc.xml new file mode 100644 index 00000000..ce226938 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/@global/cms.contenttypechannel/trainingguides.profilepage@80feb371fc.xml @@ -0,0 +1,17 @@ + + + + TrainingGuides.ProfilePage + d1a0f27c-fb65-463d-8ebd-5bbbb00866f8 + cms.contenttype + + + + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/ComponentIdentifiers.cs b/src/TrainingGuides.Web/ComponentIdentifiers.cs index 0885b0c4..49e94d7f 100644 --- a/src/TrainingGuides.Web/ComponentIdentifiers.cs +++ b/src/TrainingGuides.Web/ComponentIdentifiers.cs @@ -14,6 +14,7 @@ using TrainingGuides.Web.Features.Shared.Sections.General; using TrainingGuides.Web.Features.Shared.Sections.SingleColumn; using TrainingGuides.Web.Features.Videos.Widgets.VideoEmbed; +using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; namespace TrainingGuides.Web; @@ -42,6 +43,7 @@ public static class Widgets public const string SING_IN = SignInWidgetViewComponent.IDENTIFIER; public const string LINK_OR_SIGN_OUT = LinkOrSignOutWidgetViewComponent.IDENTIFIER; public const string REGISTRATION = RegistrationWidgetViewComponent.IDENTIFIER; + public const string RESET_PASSWORD = ResetPasswordWidgetViewComponent.IDENTIFIER; } } diff --git a/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewModel.cs index 376d28b9..83322635 100644 --- a/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewModel.cs @@ -2,11 +2,11 @@ namespace TrainingGuides.Web.Features.Articles.Widgets.ArticleList; -public class ArticleListWidgetViewModel : WidgetViewModel +public class ArticleListWidgetViewModel : IWidgetViewModel { public List Articles { get; set; } = []; public string CtaText { get; set; } = string.Empty; - public override bool IsMisconfigured => Articles == null || Articles.Count == 0; + public bool IsMisconfigured => Articles == null || Articles.Count == 0; } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Articles/Widgets/FeaturedArticle/FeaturedArticleWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Articles/Widgets/FeaturedArticle/FeaturedArticleWidgetViewModel.cs index f650fe3e..047eb59b 100644 --- a/src/TrainingGuides.Web/Features/Articles/Widgets/FeaturedArticle/FeaturedArticleWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Articles/Widgets/FeaturedArticle/FeaturedArticleWidgetViewModel.cs @@ -2,9 +2,9 @@ namespace TrainingGuides.Web.Features.Articles.Widgets.FeaturedArticle; -public class FeaturedArticleWidgetViewModel : WidgetViewModel +public class FeaturedArticleWidgetViewModel : IWidgetViewModel { public ArticlePageViewModel? Article { get; set; } - public override bool IsMisconfigured => Article == null; + public bool IsMisconfigured => Article == null; } diff --git a/src/TrainingGuides.Web/Features/HTML/Widgets/HtmlCode/HtmlCodeWidgetViewModel.cs b/src/TrainingGuides.Web/Features/HTML/Widgets/HtmlCode/HtmlCodeWidgetViewModel.cs index 8139c1e2..fd026353 100644 --- a/src/TrainingGuides.Web/Features/HTML/Widgets/HtmlCode/HtmlCodeWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/HTML/Widgets/HtmlCode/HtmlCodeWidgetViewModel.cs @@ -3,9 +3,9 @@ namespace TrainingGuides.Web.Features.Html.Widgets.HtmlCode; -public class HtmlCodeWidgetViewModel : WidgetViewModel +public class HtmlCodeWidgetViewModel : IWidgetViewModel { public HtmlString Code { get; set; } = HtmlString.Empty; - public override bool IsMisconfigured => string.IsNullOrEmpty(Code.Value); + public bool IsMisconfigured => string.IsNullOrEmpty(Code.Value); } diff --git a/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs b/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs index d6c83a05..26bc3d83 100644 --- a/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/LandingPages/Widgets/CallToAction/CallToActionWidgetViewModel.cs @@ -2,12 +2,12 @@ namespace TrainingGuides.Web.Features.LandingPages.Widgets.CallToAction; -public class CallToActionWidgetViewModel : WidgetViewModel +public class CallToActionWidgetViewModel : IWidgetViewModel { public string Text { get; set; } = string.Empty; public string Url { get; set; } = string.Empty; public bool OpenInNewTab { get; set; } public string Identifier { get; set; } = string.Empty; public bool IsDownload { get; set; } - public override bool IsMisconfigured => string.IsNullOrWhiteSpace(Text) || string.IsNullOrWhiteSpace(Url); + public bool IsMisconfigured => string.IsNullOrWhiteSpace(Text) || string.IsNullOrWhiteSpace(Url); } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/LandingPages/Widgets/HeroBanner/HeroBannerWidgetViewModel.cs b/src/TrainingGuides.Web/Features/LandingPages/Widgets/HeroBanner/HeroBannerWidgetViewModel.cs index 9118152a..47954f3e 100644 --- a/src/TrainingGuides.Web/Features/LandingPages/Widgets/HeroBanner/HeroBannerWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/LandingPages/Widgets/HeroBanner/HeroBannerWidgetViewModel.cs @@ -3,7 +3,7 @@ namespace TrainingGuides.Web.Features.LandingPages.Widgets.HeroBanner; -public class HeroBannerWidgetViewModel : WidgetViewModel +public class HeroBannerWidgetViewModel : IWidgetViewModel { public string Header { get; set; } = string.Empty; public HtmlString Subheader { get; set; } = HtmlString.Empty; @@ -24,5 +24,5 @@ public class HeroBannerWidgetViewModel : WidgetViewModel public string TextColor { get; set; } = string.Empty; public string ThemeClass { get; set; } = string.Empty; public HtmlString StyleAttribute { get; set; } = HtmlString.Empty; - public override bool IsMisconfigured => string.IsNullOrEmpty(Header); + public bool IsMisconfigured => string.IsNullOrEmpty(Header); } diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs index 34646b90..8bf35853 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Profile; using TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; using TrainingGuides.Web.Features.Shared.Helpers; using TrainingGuides.Web.Features.Shared.Services; @@ -33,6 +34,43 @@ public MemberManagementController(IMembershipService membershipService, this.preferredLanguageRetriever = preferredLanguageRetriever; } + /// + /// Updates a user profile. + /// + /// View model with profile fields to update. + /// + [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.UPDATE_PROFILE_ACTION_PATH}")] + [ValidateAntiForgeryToken] + public async Task UpdateProfile(UpdateProfileViewModel model) + { + if (!ModelState.IsValid) + { + return PartialView("~/Features/Membership/Widgets/UpdateProfile/UpdateProfileForm.cshtml", model); + } + + //Get the current member instead of pulling from the model, so that members cannot attempt to change each others information. + var guidesMember = await membershipService.GetCurrentMember(); + + if (guidesMember != null) + { + var result = await membershipService.UpdateMemberProfile(guidesMember, model); + + if (result.Succeeded) + { + model.SuccessMessage = stringLocalizer["Profile updated successfully."]; + } + else + { + foreach (var error in result.Errors) + { + ModelState.AddModelError(string.Empty, error.Description); + } + } + } + + return PartialView("~/Features/Membership/Widgets/UpdateProfile/UpdateProfileForm.cshtml", model); + } + /// /// Generates and sends password reset email. /// @@ -136,6 +174,11 @@ public async Task ResetPassword(string email, string token) } + /// + /// Resets the password of the member. + /// + /// The view model with information about whose password to reset and how + /// Model with errors or success message [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.PASSWORD_RESET_ACTION_PATH}")] [ValidateAntiForgeryToken] public async Task ResetPassword(ResetPasswordViewModel model) @@ -146,8 +189,9 @@ public async Task ResetPassword(ResetPasswordViewModel model) } string decodedToken = model.Token.Replace("%2f", "/"); + string decodedEmail = model.Email.Replace("%2f", "/"); - var guidesMember = await membershipService.FindMemberByEmail(model.Email); + var guidesMember = await membershipService.FindMemberByEmail(decodedEmail); if (guidesMember != null) { @@ -155,7 +199,7 @@ public async Task ResetPassword(ResetPasswordViewModel model) if (result.Succeeded) { - return Content(await GetSuccessContent()); + return Content(await GetResetPasswordSuccessContent()); } else { @@ -174,7 +218,7 @@ public async Task ResetPassword(ResetPasswordViewModel model) return PartialView("~/Features/Membership/Widgets/ResetPassword/ResetPasswordForm.cshtml", model); } - private async Task GetSuccessContent() + private async Task GetResetPasswordSuccessContent() { string language = preferredLanguageRetriever.Get(); string signInUrl = await membershipService.GetSignInUrl(language, absoluteURl: true); diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/GuidesMemberProfileViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Profile/GuidesMemberProfileViewModel.cs new file mode 100644 index 00000000..cac5b2a1 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/GuidesMemberProfileViewModel.cs @@ -0,0 +1,25 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace TrainingGuides.Web.Features.Membership.Profile; + +public class GuidesMemberProfileViewModel +{ + [DataType(DataType.Text)] + [MaxLength(100)] + [DisplayName("Given name")] + public string GivenName { get; set; } = string.Empty; + + [DataType(DataType.Text)] + [MaxLength(100)] + [DisplayName("Family name")] + public string FamilyName { get; set; } = string.Empty; + + [DisplayName("Family name goes first")] + public bool FamilyNameFirst { get; set; } = false; + + [DataType(DataType.Text)] + [MaxLength(100)] + [DisplayName("Favorite coffee")] + public string FavoriteCoffee { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/IUpdateProfileService.cs b/src/TrainingGuides.Web/Features/Membership/Profile/IUpdateProfileService.cs new file mode 100644 index 00000000..bf1f017f --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/IUpdateProfileService.cs @@ -0,0 +1,11 @@ +namespace TrainingGuides.Web.Features.Membership.Profile; + +public interface IUpdateProfileService +{ + /// + /// Get the view model for the update profile view component. + /// + /// The member to base the view model on. + /// An based on the values of the 's properties. + UpdateProfileViewModel GetViewModel(GuidesMember guidesMember); +} diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePageController.cs b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePageController.cs new file mode 100644 index 00000000..2eb2709c --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePageController.cs @@ -0,0 +1,14 @@ +using Kentico.Content.Web.Mvc.Routing; +using Kentico.PageBuilder.Web.Mvc.PageTemplates; +using Microsoft.AspNetCore.Mvc; +using TrainingGuides; + +[assembly: RegisterWebPageRoute( + contentTypeName: ProfilePage.CONTENT_TYPE_NAME, + controllerType: typeof(TrainingGuides.Web.Features.Membership.Profile.ProfilePageController))] + +namespace TrainingGuides.Web.Features.Membership.Profile; +public class ProfilePageController : Controller +{ + public IActionResult Index() => new TemplateResult(); +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs new file mode 100644 index 00000000..418e655e --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs @@ -0,0 +1,16 @@ +using Kentico.PageBuilder.Web.Mvc.PageTemplates; +using TrainingGuides; +using TrainingGuides.Web.Features.Membership.Profile; + +[assembly: RegisterPageTemplate( + identifier: ProfilePagePageTemplate.IDENTIFIER, + name: "Article page content type template", + customViewName: "~/Features/Articles/ArticlePagePageTemplate.cshtml", + ContentTypeNames = [ProfilePage.CONTENT_TYPE_NAME], + IconClass = "xp-a-lowercase")] + +namespace TrainingGuides.Web.Features.Membership.Profile; +public static class ProfilePagePageTemplate +{ + public const string IDENTIFIER = "TrainingGuides.ProfilePagePageTemplate"; +} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml new file mode 100644 index 00000000..df12870c --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml @@ -0,0 +1,22 @@ +@using TrainingGuides.Web.Features.Membership.Profile; +@using TrainingGuides.Web.Features.Shared.Helpers; + +@model UpdateProfileViewModel + +@{ + string formDivId = $"updateProfileForm{Guid.NewGuid()}"; +} +

@Model.FullName

+
@Model.EmailAddress
+ +@using (Html.AjaxBeginForm("UpdateProfile", "MembershipManagement", new AjaxOptions +{ + HttpMethod = "POST", + InsertionMode = InsertionMode.Replace, + UpdateTargetId = formDivId +}, new { action = $"{Model.BaseUrl}/{Model.Language}{ApplicationConstants.UPDATE_PROFILE_ACTION_PATH}" })) +{ +
+ +
+} diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml new file mode 100644 index 00000000..98659e1c --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml @@ -0,0 +1,56 @@ +@using TrainingGuides.Web.Features.Membership.Profile; + +@model UpdateProfileViewModel + +
+
+ + + +
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+ +
+ +
+
+@if (!string.IsNullOrEmpty(Model.SuccessMessage)) +{ +
+ @Model.SuccessMessage +
+} \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs new file mode 100644 index 00000000..a9c4b1a7 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs @@ -0,0 +1,38 @@ +using Kentico.Content.Web.Mvc.Routing; +using Microsoft.Extensions.Localization; +using TrainingGuides.Web.Features.Shared.Services; + +namespace TrainingGuides.Web.Features.Membership.Profile; + +public class UpdateProfileService +{ + private readonly IHttpRequestService httpRequestService; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever; + private readonly IStringLocalizer stringLocalizer; + + public UpdateProfileService(IHttpRequestService httpRequestService, + IPreferredLanguageRetriever preferredLanguageRetriever, + IStringLocalizer stringLocalizer) + { + this.httpRequestService = httpRequestService; + this.preferredLanguageRetriever = preferredLanguageRetriever; + this.stringLocalizer = stringLocalizer; + } + + /// + public UpdateProfileViewModel GetViewModel(GuidesMember guidesMember) => + new() + { + GivenName = guidesMember?.GivenName ?? string.Empty, + FamilyName = guidesMember?.FamilyName ?? string.Empty, + FamilyNameFirst = guidesMember?.FamilyNameFirst ?? false, + FavoriteCoffee = guidesMember?.FavoriteCoffee ?? string.Empty, + EmailAddress = guidesMember?.Email ?? string.Empty, + FullName = guidesMember?.FullName ?? string.Empty, + Created = guidesMember?.Created ?? DateTime.MinValue, + BaseUrl = httpRequestService.GetBaseUrl(), + Language = preferredLanguageRetriever.Get(), + SubmitButtonText = stringLocalizer["Submit"], + SuccessMessage = string.Empty + }; +} diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs new file mode 100644 index 00000000..5e76df07 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs @@ -0,0 +1,40 @@ +using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Membership.Services; +using Kentico.Content.Web.Mvc; +using Kentico.PageBuilder.Web.Mvc; +using Kentico.Web.Mvc; + +namespace TrainingGuides.Web.Features.Membership.Profile; + +public class UpdateProfileViewComponent : ViewComponent +{ + private readonly IMembershipService membershipService; + private readonly IHttpContextAccessor httpContextAccessor; + private readonly IUpdateProfileService updateProfileService; + + + public UpdateProfileViewComponent(IMembershipService membershipService, + IHttpContextAccessor httpContextAccessor, + IUpdateProfileService updateProfileService) + { + this.membershipService = membershipService; + this.httpContextAccessor = httpContextAccessor; + this.updateProfileService = updateProfileService; + } + public async Task InvokeAsync() + { + var httpContext = httpContextAccessor.HttpContext; + GuidesMember currentMember; + + bool useDummyMember = httpContext.Kentico().PageBuilder().GetMode() != PageBuilderMode.Off || httpContext.Kentico().Preview().Enabled; + + currentMember = useDummyMember + ? membershipService.DummyMember + : await membershipService.GetCurrentMember() ?? membershipService.DummyMember; + + var model = updateProfileService.GetViewModel(currentMember); + + return View("~/Features/Membership/ViewComponents/UpdateProfile/UpdateProfile.cshtml", model); + } + +} diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs new file mode 100644 index 00000000..4e20bca3 --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Mvc; + +namespace TrainingGuides.Web.Features.Membership.Profile; + +public class UpdateProfileViewModel : GuidesMemberProfileViewModel +{ + public string FullName { get; set; } = string.Empty; + + public string EmailAddress { get; set; } = string.Empty; + + public DateTime Created { get; set; } + + public string BaseUrl { get; set; } = string.Empty; + + public string Language { get; set; } = string.Empty; + + public string SuccessMessage { get; set; } = string.Empty; + + [HiddenInput] + public string SubmitButtonText { get; set; } = string.Empty; + +} diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 9b317f17..171130fd 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Identity; +using TrainingGuides.Web.Features.Membership.Profile; namespace TrainingGuides.Web.Features.Membership.Services; @@ -7,6 +8,12 @@ namespace TrainingGuides.Web.Features.Membership.Services; ///
public interface IMembershipService { + /// + /// Generates a dummy member for display in page builder and preview modes. + /// + /// A dummy member + GuidesMember DummyMember { get; } + /// /// Gets the current member. /// @@ -101,4 +108,13 @@ public interface IMembershipService /// Whether to return an absolute URL. /// The relative path of the sign in page. Task GetSignInUrl(string language, bool absoluteURl = false); + + /// + /// Updates the profile of a member. + /// + /// Member to update. + /// ViewModel with updated fields. + /// + Task UpdateMemberProfile(GuidesMember member, UpdateProfileViewModel updateProfileViewModel); + } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 442b5dd5..9611a4c2 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -2,11 +2,25 @@ using CMS.Core; using CMS.Websites.Routing; using Microsoft.AspNetCore.Identity; +using TrainingGuides.Web.Features.Membership.Profile; using TrainingGuides.Web.Features.Shared.Helpers; namespace TrainingGuides.Web.Features.Membership.Services; public class MembershipService : IMembershipService { + public GuidesMember DummyMember => new() + { + UserName = "JohnDoe", + Email = "JohnDoe@localhost.local", + GivenName = "John", + FamilyName = "Doe", + FamilyNameFirst = false, + FavoriteCoffee = "Latte", + Enabled = true, + Created = DateTime.Now, + Id = 0 + }; + private readonly UserManager userManager; private readonly SignInManager signInManager; private readonly IHttpContextAccessor contextAccessor; @@ -144,4 +158,15 @@ public async Task GetSignInUrl(string language, bool absoluteURl = false return absoluteURl ? signInUrl.AbsoluteUrl : signInUrl.RelativePath; } + + /// + public async Task UpdateMemberProfile(GuidesMember guidesMember, UpdateProfileViewModel updateProfileViewModel) + { + guidesMember.GivenName = updateProfileViewModel.GivenName; + guidesMember.FamilyName = updateProfileViewModel.FamilyName; + guidesMember.FamilyNameFirst = updateProfileViewModel.FamilyNameFirst; + guidesMember.FavoriteCoffee = updateProfileViewModel.FavoriteCoffee; + + return await userManager.UpdateAsync(guidesMember); + } } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs index f6c076c0..6ab6ea92 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/LinkOrSignOut/LinkOrSignOutWidgetViewModel.cs @@ -2,9 +2,9 @@ namespace TrainingGuides.Web.Features.Membership.Widgets.LinkOrSignOut; -public class LinkOrSignOutWidgetViewModel : WidgetViewModel +public class LinkOrSignOutWidgetViewModel : IWidgetViewModel { - public override bool IsMisconfigured => + public bool IsMisconfigured => string.IsNullOrWhiteSpace(ButtonText) || string.IsNullOrWhiteSpace(Url); public string Text { get; set; } = string.Empty; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs index 14342085..f3c6566b 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/Registration/RegistrationWidgetViewModel.cs @@ -1,16 +1,16 @@ using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc; +using TrainingGuides.Web.Features.Membership.Profile; using TrainingGuides.Web.Features.Shared.Models; -// using TrainingGuides.Web.Features.Membership.Widgets.Registration; -public class RegistrationWidgetViewModel : WidgetViewModel +public class RegistrationWidgetViewModel : GuidesMemberProfileViewModel, IWidgetViewModel { //WIDGET DISPLAY PROPERTIES /// /// Determines whether the widget is misconfigured. /// - public override bool IsMisconfigured => + public bool IsMisconfigured => string.IsNullOrWhiteSpace(BaseUrl) || string.IsNullOrWhiteSpace(SubmitButtonText) || string.IsNullOrWhiteSpace(UserNameLabel) @@ -135,17 +135,4 @@ public class RegistrationWidgetViewModel : WidgetViewModel [Compare(nameof(Password))] public string ConfirmPassword { get; set; } = string.Empty; - [DataType(DataType.Text)] - [MaxLength(100)] - public string GivenName { get; set; } = string.Empty; - - [DataType(DataType.Text)] - [MaxLength(100)] - public string FamilyName { get; set; } = string.Empty; - - public bool FamilyNameFirst { get; set; } = false; - - [DataType(DataType.Text)] - [MaxLength(100)] - public string FavoriteCoffee { get; set; } = string.Empty; } diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs index a77409cb..a77d72eb 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordWidgetViewModel.cs @@ -4,9 +4,9 @@ namespace TrainingGuides.Web.Features.Membership.Widgets.ResetPassword; -public class ResetPasswordWidgetViewModel : WidgetViewModel +public class ResetPasswordWidgetViewModel : IWidgetViewModel { - public override bool IsMisconfigured => + public bool IsMisconfigured => string.IsNullOrWhiteSpace(BaseUrlWithLanguage) || string.IsNullOrWhiteSpace(SubmitButtonText) || string.IsNullOrWhiteSpace(EmailAddressLabel); diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index 3795a2ee..36b096b0 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -4,7 +4,7 @@ namespace TrainingGuides.Web.Features.Membership.Widgets.SignIn; -public class SignInWidgetViewModel : WidgetViewModel +public class SignInWidgetViewModel : IWidgetViewModel { //WIDGET DISPLAY PROPERTIES @@ -75,7 +75,7 @@ public class SignInWidgetViewModel : WidgetViewModel public bool StaySignedIn { get; set; } = false; - public override bool IsMisconfigured => string.IsNullOrWhiteSpace(BaseUrl) + public bool IsMisconfigured => string.IsNullOrWhiteSpace(BaseUrl) || string.IsNullOrWhiteSpace(SubmitButtonText) || string.IsNullOrWhiteSpace(UserNameOrEmailLabel) || string.IsNullOrWhiteSpace(PasswordLabel) diff --git a/src/TrainingGuides.Web/Features/Products/Widgets/Product/ProductWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Products/Widgets/Product/ProductWidgetViewModel.cs index 198e24a5..6d99dcd2 100644 --- a/src/TrainingGuides.Web/Features/Products/Widgets/Product/ProductWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Products/Widgets/Product/ProductWidgetViewModel.cs @@ -3,7 +3,7 @@ namespace TrainingGuides.Web.Features.Products.Widgets.Product; -public class ProductWidgetViewModel : WidgetViewModel +public class ProductWidgetViewModel : IWidgetViewModel { public ProductPageViewModel? Product { get; set; } public bool ShowProductFeatures { get; set; } @@ -17,5 +17,5 @@ public class ProductWidgetViewModel : WidgetViewModel public string CallToActionCssClasses { get; set; } = string.Empty; public bool IsImagePositionSide { get; set; } = false; - public override bool IsMisconfigured => Product == null; + public bool IsMisconfigured => Product == null; } diff --git a/src/TrainingGuides.Web/Features/Products/Widgets/ProductComparator/ProductComparatorWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Products/Widgets/ProductComparator/ProductComparatorWidgetViewModel.cs index 0f0b3ff0..7195936e 100644 --- a/src/TrainingGuides.Web/Features/Products/Widgets/ProductComparator/ProductComparatorWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Products/Widgets/ProductComparator/ProductComparatorWidgetViewModel.cs @@ -4,7 +4,7 @@ namespace TrainingGuides.Web.Features.Products.Widgets.ProductComparator; -public class ProductComparatorWidgetViewModel : WidgetViewModel +public class ProductComparatorWidgetViewModel : IWidgetViewModel { public List Products { get; set; } = []; public List> GroupedFeatures { get; set; } = []; @@ -13,5 +13,5 @@ public class ProductComparatorWidgetViewModel : WidgetViewModel public string HeadingMargin { get; set; } = string.Empty; public bool ShowShortDescription { get; set; } public string CheckboxIconUrl { get; set; } = string.Empty; - public override bool IsMisconfigured => Products.Count == 0; + public bool IsMisconfigured => Products.Count == 0; } diff --git a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs index 11f28c2f..a0633a42 100644 --- a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs +++ b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs @@ -9,6 +9,7 @@ internal static class ApplicationConstants public const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; public const string ACCESS_DENIED_ACTION_PATH = "/Authentication/AccessDenied"; public const string REQUEST_RESET_PASSWORD_ACTION_PATH = "/MembershipManagement/RequestResetPassword"; + public const string UPDATE_PROFILE_ACTION_PATH = "/MembershipManagement/UpdateProfile"; public const string PASSWORD_RESET_ACTION_PATH = "/MembershipManagement/ResetPassword"; public const string REGISTER_ACTION_PATH = "/Registration/Register"; public const string RETURN_URL_PARAMETER = "returnUrl"; diff --git a/src/TrainingGuides.Web/Features/Shared/Models/WidgetViewModel.cs b/src/TrainingGuides.Web/Features/Shared/Models/IWidgetViewModel.cs similarity index 74% rename from src/TrainingGuides.Web/Features/Shared/Models/WidgetViewModel.cs rename to src/TrainingGuides.Web/Features/Shared/Models/IWidgetViewModel.cs index 32f16506..0fbbd6f8 100644 --- a/src/TrainingGuides.Web/Features/Shared/Models/WidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Shared/Models/IWidgetViewModel.cs @@ -1,6 +1,6 @@ namespace TrainingGuides.Web.Features.Shared.Models; -public abstract class WidgetViewModel +public interface IWidgetViewModel { public abstract bool IsMisconfigured { get; } } diff --git a/src/TrainingGuides.Web/Resources/SharedResources.es.resx b/src/TrainingGuides.Web/Resources/SharedResources.es.resx index a4a2e980..233428ac 100644 --- a/src/TrainingGuides.Web/Resources/SharedResources.es.resx +++ b/src/TrainingGuides.Web/Resources/SharedResources.es.resx @@ -159,9 +159,6 @@ Restablecer contraseña - - Enviar - ¡Éxito! @@ -188,6 +185,7 @@ Solicitud de restablecimiento de contraseña + Error en el registro. @@ -200,4 +198,26 @@ Repasar al inicio + + Nombre + + + Apellido + + + Apellido antes de nombre + + + Café favorito + + + Contraseña + + + Confirme su contraseña + + + + Enviar + \ No newline at end of file From 1a609ce5bead594e40d134843992820e5982ee72 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Wed, 27 Nov 2024 13:26:33 +0100 Subject: [PATCH 55/60] no message --- .../SignIn/SignInWidgetViewComponentTests.cs | 16 ++++++--- .../SignIn/SignInWidgetViewModelTests.cs | 3 ++ .../ComponentIdentifiers.cs | 2 +- .../Controllers/AuthenticationController.cs | 11 ++++-- .../Controllers/RegistrationController.cs | 36 +++++++++++++------ .../Widgets/SignIn/SignInWidget.cshtml | 5 ++- .../SignIn/SignInWidgetViewComponent.cs | 3 +- .../Widgets/SignIn/SignInWidgetViewModel.cs | 6 ++++ .../Shared/Helpers/ApplicationConstants.cs | 3 ++ .../Services/ContentItemRetrieverService.cs | 4 +-- 10 files changed, 64 insertions(+), 25 deletions(-) diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs index 2f967dc7..879ac175 100644 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewComponentTests.cs @@ -15,6 +15,7 @@ public class SignInWidgetViewComponentTests private readonly Mock preferredLanguageRetrieverMock; private const string BASE_URL = "http://localhost:5000"; + private const string LANGUAGE_KEY = "en"; private const string PAGE_URL = "/page"; private const string ROOT_URL = "/"; private const string SIGN_IN = "Sign In"; @@ -34,7 +35,7 @@ public SignInWidgetViewComponentTests() membershipServiceMock.Setup(x => x.IsMemberAuthenticated()).ReturnsAsync(true); preferredLanguageRetrieverMock = new Mock(); - preferredLanguageRetrieverMock.Setup(x => x.Get()).Returns("en"); + preferredLanguageRetrieverMock.Setup(x => x.Get()).Returns(LANGUAGE_KEY); viewComponent = new SignInWidgetViewComponent(httpRequestServiceMock.Object, membershipServiceMock.Object, preferredLanguageRetrieverMock.Object); @@ -56,13 +57,20 @@ public async Task BuildWidgetViewModel_ReturnsWidgetViewModel_WithBaseUrlSet() } [Fact] - public async Task BuildWidgetViewModel_WhenUserSetsRedirectPage_SetsRedirectUrl_ToPageUrl() + public async Task BuildWidgetViewModel_ReturnsWidgetViewModel_WithLanguageSet_ToCurrentLanguage() { - httpRequestServiceMock.Setup(x => x.GetPageRelativeUrl(It.IsAny(), It.IsAny())).ReturnsAsync($"~{PAGE_URL}"); + var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); + Assert.Equal(LANGUAGE_KEY, viewModel.Language); + } + + [Fact] + public async Task BuildWidgetViewModel_WhenUserSetsRedirectPage_SetsRedirectUrl_ToPageUrlInCurrentLanguage() + { + httpRequestServiceMock.Setup(x => x.GetPageRelativeUrl(It.IsAny(), It.IsAny())).ReturnsAsync($"~/{LANGUAGE_KEY}{PAGE_URL}"); referenceProperties.RedirectPage = [new() { WebPageGuid = Guid.NewGuid() }]; var viewModel = await viewComponent.BuildWidgetViewModel(referenceProperties); - Assert.Equal(PAGE_URL, viewModel.RedirectUrl); + Assert.Equal($"/{LANGUAGE_KEY + PAGE_URL}", viewModel.RedirectUrl); } [Fact] diff --git a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs index bef3caae..994d62e8 100644 --- a/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs +++ b/src/TrainingGuides.Web.Tests/Features/Membership/Widgets/SignIn/SignInWidgetViewModelTests.cs @@ -15,6 +15,9 @@ public SignInWidgetViewModelTests() [Fact] public void WhenModelInitialized_BaseUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.BaseUrl); + [Fact] + public void WhenModelInitialized_Language_IsEmpty() => Assert.Equal(string.Empty, viewModel.Language); + [Fact] public void WhenModelInitialized_RedirectUrl_IsEmpty() => Assert.Equal(string.Empty, viewModel.RedirectUrl); diff --git a/src/TrainingGuides.Web/ComponentIdentifiers.cs b/src/TrainingGuides.Web/ComponentIdentifiers.cs index 49e94d7f..eb0fdf68 100644 --- a/src/TrainingGuides.Web/ComponentIdentifiers.cs +++ b/src/TrainingGuides.Web/ComponentIdentifiers.cs @@ -40,7 +40,7 @@ public static class Widgets public const string SIMPLE_CALL_TO_ACTION = SimpleCallToActionWidgetViewComponent.IDENTIFIER; public const string PRODUCT = ProductWidgetViewComponent.IDENTIFIER; public const string VIDEO_EMBED = VideoEmbedWidgetViewComponent.IDENTIFIER; - public const string SING_IN = SignInWidgetViewComponent.IDENTIFIER; + public const string SIGN_IN = SignInWidgetViewComponent.IDENTIFIER; public const string LINK_OR_SIGN_OUT = LinkOrSignOutWidgetViewComponent.IDENTIFIER; public const string REGISTRATION = RegistrationWidgetViewComponent.IDENTIFIER; public const string RESET_PASSWORD = ResetPasswordWidgetViewComponent.IDENTIFIER; diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs index 422a0b14..dcd459fd 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/AuthenticationController.cs @@ -7,6 +7,7 @@ using Kentico.Content.Web.Mvc.Routing; using CMS.DataEngine; using CMS.ContentEngine; +using Microsoft.Extensions.Localization; namespace TrainingGuides.Web.Features.Membership.Controllers; @@ -17,20 +18,24 @@ public class AuthenticationController : Controller private readonly IMembershipService membershipService; private readonly IPreferredLanguageRetriever preferredLanguageRetriever; private readonly IInfoProvider contentLanguageInfoProvider; + private readonly IStringLocalizer stringLocalizer; + private const string SIGN_IN_FAILED = "Your sign-in attempt was not successful. Please try again."; public AuthenticationController(IMembershipService membershipService, IPreferredLanguageRetriever preferredLanguageRetriever, - IInfoProvider contentLanguageInfoProvider) + IInfoProvider contentLanguageInfoProvider, + IStringLocalizer stringLocalizer) { this.membershipService = membershipService; this.preferredLanguageRetriever = preferredLanguageRetriever; this.contentLanguageInfoProvider = contentLanguageInfoProvider; + this.stringLocalizer = stringLocalizer; } private IActionResult RenderError(SignInWidgetViewModel model) { - ModelState.AddModelError(string.Empty, SIGN_IN_FAILED); + ModelState.AddModelError(string.Empty, stringLocalizer[SIGN_IN_FAILED]); return PartialView("~/Features/Membership/Widgets/SignIn/SignInForm.cshtml", model); } @@ -46,7 +51,7 @@ private IActionResult RenderSuccess(string redirectUrl) return PartialView("~/Features/Membership/Widgets/SignIn/SignInForm.cshtml", model); } - [HttpPost("/Authentication/Authenticate")] + [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.AUTHENTICATE_ACTION_PATH}")] [ValidateAntiForgeryToken] public async Task Authenticate(SignInWidgetViewModel model) { diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 9a7a32c0..c3232f52 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -14,6 +14,7 @@ using TrainingGuides.Web.Features.Membership.Widgets.Registration; using TrainingGuides.Web.Features.Shared.Services; using TrainingGuides.Web.Features.Shared.Helpers; +using Kentico.Content.Web.Mvc.Routing; namespace TrainingGuides.Web.Features.Membership.Controllers; @@ -23,7 +24,8 @@ public class RegistrationController( IStringLocalizer stringLocalizer, IEmailService emailService, IOptions systemEmailOptions, - IHttpRequestService httpRequestService) : Controller + IHttpRequestService httpRequestService, + IPreferredLanguageRetriever preferredLanguageRetriever) : Controller { private readonly IMembershipService membershipService = membershipService; @@ -33,6 +35,8 @@ public class RegistrationController( private readonly SystemEmailOptions systemEmailOptions = systemEmailOptions.Value; private readonly IHttpRequestService httpRequestService = httpRequestService; + private readonly IPreferredLanguageRetriever preferredLanguageRetriever = preferredLanguageRetriever; + [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.REGISTER_ACTION_PATH}")] [ValidateAntiForgeryToken] public async Task Register(RegistrationWidgetViewModel model) @@ -103,9 +107,13 @@ private ActionResult ReturnEmailConfirmationView(EmailConfirmationViewModel emai [HttpGet("/Registration/Confirm")] + // [HttpGet($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.CONFIRM_REGISTRATION_ACTION_PATH}")] public async Task Confirm(string memberEmail, string confirmToken) { string userName; + //TODO + // var language = preferredLanguageRetriever.Get(); + if (!(HttpContext.Kentico().PageBuilder().EditMode || HttpContext.Kentico().Preview().Enabled)) { IdentityResult confirmResult; @@ -172,29 +180,35 @@ public async Task Confirm(string memberEmail, string confirmToken) private async Task SendVerificationEmail(GuidesMember member) { string confirmToken = await membershipService.GenerateEmailConfirmationToken(member); + string memberEmail = member.Email ?? string.Empty; - string confirmationURL = Url.Action(nameof(Confirm), "Registration", - new + var routeValues = new RouteValueDictionary { - memberEmail = member.Email, - confirmToken - }, - Request.Scheme) ?? string.Empty; + { ApplicationConstants.LANGUAGE_KEY, preferredLanguageRetriever.Get() }, + { nameof(memberEmail), memberEmail }, + { nameof(confirmToken), confirmToken } + }; + + string confirmationURL = Url.Action( + nameof(Confirm), + "Registration", + routeValues, + Request.Scheme) ?? string.Empty; await emailService.SendEmail(new EmailMessage() { From = $"no-reply@{systemEmailOptions.SendingDomain}", Recipients = member.Email, - Subject = $"Confirm your email here", + Subject = $"{stringLocalizer["Confirm your email here"]}", Body = $""" -

To confirm your email address, click here.

-

You can also copy and paste this URL into your browser.

+

{stringLocalizer["To confirm your email address, click "]}{stringLocalizer["here"]}.

+

{stringLocalizer["You can also copy and paste this URL into your browser."]}

{confirmationURL}

""" }); } - [HttpPost("/Registration/ResendVerificationEmail")] + [HttpPost($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.RESEND_VERIFICATION_EMAIL}")] public async Task ResendVerificationEmail(EmailConfirmationViewModel model) { string userName = model.Username; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml index e5066662..ed166a59 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidget.cshtml @@ -20,13 +20,12 @@ // Using a new guid ensures no conflict if, for some reason, multiple widgets are on the same page. var formDivId = $"signInForm{Guid.NewGuid()}"; - @using (Html.AjaxBeginForm("Autheticate", "Authentication", new AjaxOptions + @using (Html.AjaxBeginForm("Authenticate", "Authentication", new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = formDivId, - @* OnSuccess = "RedirectOnAuthenticationSuccess(data)" *@ - }, new { action = $"{Model.BaseUrl}/Authentication/Authenticate" })) + }, new { action = $"{Model.BaseUrl}/{Model.Language}/Authentication/Authenticate" })) {
diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs index eb19b217..ae1c5b93 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs @@ -44,12 +44,13 @@ public async Task BuildWidgetViewModel(SignInWidgetProper string redirectUrl = returnUrl ?? (redirectPage == null - ? "/" + ? $"/{preferredLanguageRetriever.Get()}" : (await httpRequestService.GetPageRelativeUrl(redirectPage.WebPageGuid, preferredLanguageRetriever.Get())).Replace("~", "")); return new SignInWidgetViewModel { BaseUrl = httpRequestService.GetBaseUrl(), + Language = preferredLanguageRetriever.Get(), RedirectUrl = redirectUrl, DisplayForm = !await membershipService.IsMemberAuthenticated(), FormTitle = properties.FormTitle, diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs index 36b096b0..caf5a91c 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewModel.cs @@ -14,6 +14,12 @@ public class SignInWidgetViewModel : IWidgetViewModel [HiddenInput] public string BaseUrl { get; set; } = string.Empty; + /// + /// The language of the current request + /// + [HiddenInput] + public string Language { get; set; } = string.Empty; + /// /// URL of the site to redirect to after successful sing in /// diff --git a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs index a0633a42..b1ea82bc 100644 --- a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs +++ b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs @@ -12,5 +12,8 @@ internal static class ApplicationConstants public const string UPDATE_PROFILE_ACTION_PATH = "/MembershipManagement/UpdateProfile"; public const string PASSWORD_RESET_ACTION_PATH = "/MembershipManagement/ResetPassword"; public const string REGISTER_ACTION_PATH = "/Registration/Register"; + public const string CONFIRM_REGISTRATION_ACTION_PATH = "/Registration/Confirm"; + public const string RESEND_VERIFICATION_EMAIL = "/Registration/ResendVerificationEmail"; + public const string AUTHENTICATE_ACTION_PATH = "/Authentication/Authenticate"; public const string RETURN_URL_PARAMETER = "returnUrl"; } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs index 4cc89889..da6842f3 100644 --- a/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs +++ b/src/TrainingGuides.Web/Features/Shared/Services/ContentItemRetrieverService.cs @@ -291,7 +291,7 @@ private async Task> RetrieveWebPages(Action /// Retrieves the IWebPageFieldsSource of a web page item by Id. ///
- /// the Id of the web page item + /// The Id of the web page item /// object containing generic for the item public async Task RetrieveWebPageById( int webPageItemId) @@ -323,7 +323,7 @@ private async Task> RetrieveWebPages(Action /// Retrieves the IWebPageFieldsSource of a web page item by path. ///
- /// the path of the web page item + /// The Tree path of the web page item (can be found in the administration under the Properties tab). /// object containing generic for the item public async Task RetrieveWebPageByPath(string pathToMatch, bool includeSecuredItems = true) From dcfbd38fee20390580bf1ee6d7f09575c85bab45 Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Wed, 27 Nov 2024 14:17:20 +0100 Subject: [PATCH 56/60] GH-87 :: implement review suggestions (together with the previous commit with the accidentally empty message) --- .../Membership/Controllers/RegistrationController.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index c3232f52..69c314bd 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -106,14 +106,10 @@ private ActionResult ReturnEmailConfirmationView(EmailConfirmationViewModel emai }; - [HttpGet("/Registration/Confirm")] - // [HttpGet($"{{{ApplicationConstants.LANGUAGE_KEY}}}{ApplicationConstants.CONFIRM_REGISTRATION_ACTION_PATH}")] + [HttpGet($"{ApplicationConstants.CONFIRM_REGISTRATION_ACTION_PATH}/{{{ApplicationConstants.LANGUAGE_KEY}}}")] public async Task Confirm(string memberEmail, string confirmToken) { string userName; - //TODO - // var language = preferredLanguageRetriever.Get(); - if (!(HttpContext.Kentico().PageBuilder().EditMode || HttpContext.Kentico().Preview().Enabled)) { IdentityResult confirmResult; From 91f4e239d72378d23939a72b96be83f8cf663cce Mon Sep 17 00:00:00 2001 From: DominikaG2 Date: Wed, 27 Nov 2024 17:15:18 +0100 Subject: [PATCH 57/60] GH-91 :: implement review suggestions - fix multilingual URLs --- .../Controllers/MemberManagementController.cs | 4 +-- .../Controllers/RegistrationController.cs | 22 +++++++-------- .../Membership/Services/IMembershipService.cs | 12 +++++++-- .../Membership/Services/MembershipService.cs | 27 +++++++++++++++---- .../SignIn/SignInWidgetViewComponent.cs | 2 +- .../Shared/Helpers/ApplicationConstants.cs | 1 + 6 files changed, 45 insertions(+), 23 deletions(-) diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs index 8bf35853..e22fa3b0 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs @@ -221,8 +221,8 @@ public async Task ResetPassword(ResetPasswordViewModel model) private async Task GetResetPasswordSuccessContent() { string language = preferredLanguageRetriever.Get(); - string signInUrl = await membershipService.GetSignInUrl(language, absoluteURl: true); - string baseUrl = httpRequestService.GetBaseUrlWithLanguage(checkDatabaseForDefaultLanguage: true); + string signInUrl = await membershipService.GetSignInUrl(language, true); + string baseUrl = httpRequestService.GetBaseUrlWithLanguage(true); string success = stringLocalizer["Success!"]; string signIn = stringLocalizer["Sign in"]; diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 69c314bd..38ad833e 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -91,18 +91,14 @@ private ActionResult ReturnEmailConfirmationView(EmailConfirmationViewModel emai return View("~/Features/Membership/Widgets/Registration/EmailConfirmation.cshtml", emailConfirmationViewModel); } - // the system counts on an existence of a sign in anf registration pages with the following URLs - private string GetSignInUrl() => $"{httpRequestService.GetBaseUrlWithLanguage()}/sign-in"; - private string GetRegisterUrl() => $"{httpRequestService.GetBaseUrlWithLanguage()}/register"; - - private EmailConfirmationViewModel GetMemberNotFoundViewModel() => new() + private async Task GetMemberNotFoundViewModel() => new() { State = EmailConfirmationState.FailureNotYetConfirmed, Message = stringLocalizer["Email confirmation failed. This user does not exist."], ActionButtonText = stringLocalizer["Register"], - SignInOrRegisterPageUrl = GetRegisterUrl(), + SignInOrRegisterPageUrl = await membershipService.GetRegisterUrl(preferredLanguageRetriever.Get(), true), HomePageButtonText = stringLocalizer["Go to homepage"], - HomePageUrl = httpRequestService.GetBaseUrlWithLanguage() + HomePageUrl = httpRequestService.GetBaseUrlWithLanguage(true) }; @@ -118,7 +114,7 @@ public async Task Confirm(string memberEmail, string confirmToken) if (member is null) { - return ReturnEmailConfirmationView(GetMemberNotFoundViewModel()); + return ReturnEmailConfirmationView(await GetMemberNotFoundViewModel()); } if (member.Enabled) @@ -128,9 +124,9 @@ public async Task Confirm(string memberEmail, string confirmToken) State = EmailConfirmationState.SuccessAlreadyConfirmed, Message = stringLocalizer["Your email is already verified."], ActionButtonText = stringLocalizer["Sign in"], - SignInOrRegisterPageUrl = GetSignInUrl(), + SignInOrRegisterPageUrl = await membershipService.GetSignInUrl(preferredLanguageRetriever.Get(), true), HomePageButtonText = stringLocalizer["Go to homepage"], - HomePageUrl = httpRequestService.GetBaseUrlWithLanguage() + HomePageUrl = httpRequestService.GetBaseUrlWithLanguage(true) }); } @@ -151,9 +147,9 @@ public async Task Confirm(string memberEmail, string confirmToken) State = EmailConfirmationState.SuccessConfirmed, Message = stringLocalizer["Success! Email confirmed."], ActionButtonText = stringLocalizer["Sign in"], - SignInOrRegisterPageUrl = GetSignInUrl(), + SignInOrRegisterPageUrl = await membershipService.GetSignInUrl(preferredLanguageRetriever.Get(), true), HomePageButtonText = stringLocalizer["Go to homepage"], - HomePageUrl = httpRequestService.GetBaseUrlWithLanguage() + HomePageUrl = httpRequestService.GetBaseUrlWithLanguage(true) }); } @@ -212,7 +208,7 @@ public async Task ResendVerificationEmail(EmailConfirmationViewMod if (member is null) { - return ReturnEmailConfirmationView(GetMemberNotFoundViewModel()); + return ReturnEmailConfirmationView(await GetMemberNotFoundViewModel()); } await SendVerificationEmail(member); diff --git a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs index 171130fd..83f6efba 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/IMembershipService.cs @@ -105,9 +105,17 @@ public interface IMembershipService /// Gets the URL of the expected sign in page in the provided language. /// /// The required language to retrieve. - /// Whether to return an absolute URL. + /// Whether to return an absolute URL. /// The relative path of the sign in page. - Task GetSignInUrl(string language, bool absoluteURl = false); + Task GetSignInUrl(string language, bool absoluteURL = false); + + /// + /// Gets the URL of the expected registration page in the provided language. + /// + /// The required language to retrieve. + /// Whether to return an absolute URL. + /// The relative path of the sign in page. + Task GetRegisterUrl(string language, bool absoluteURL = false); /// /// Updates the profile of a member. diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 9611a4c2..74255624 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Identity; using TrainingGuides.Web.Features.Membership.Profile; using TrainingGuides.Web.Features.Shared.Helpers; +using TrainingGuides.Web.Features.Shared.Services; namespace TrainingGuides.Web.Features.Membership.Services; public class MembershipService : IMembershipService @@ -28,6 +29,8 @@ public class MembershipService : IMembershipService private readonly IMemberContactService memberContactService; private readonly IWebPageUrlRetriever webPageUrlRetriever; private readonly IWebsiteChannelContext websiteChannelContext; + private readonly IHttpRequestService httpRequestService; + public MembershipService( UserManager userManager, @@ -36,7 +39,8 @@ public MembershipService( IEventLogService eventLogService, IMemberContactService memberContactService, IWebPageUrlRetriever webPageUrlRetriever, - IWebsiteChannelContext websiteChannelContext) + IWebsiteChannelContext websiteChannelContext, + IHttpRequestService httpRequestService) { this.userManager = userManager; this.signInManager = signInManager; @@ -45,6 +49,7 @@ public MembershipService( this.memberContactService = memberContactService; this.webPageUrlRetriever = webPageUrlRetriever; this.websiteChannelContext = websiteChannelContext; + this.httpRequestService = httpRequestService; } /// @@ -147,18 +152,30 @@ await userManager.VerifyUserTokenAsync(user: member, public async Task ResetPassword(GuidesMember member, string token, string password) => await userManager.ResetPasswordAsync(member, token, password); - /// - public async Task GetSignInUrl(string language, bool absoluteURl = false) + private async Task GetPageUrl(string expectedPagePath, string language, bool absoluteURL = false) { var signInUrl = await webPageUrlRetriever.Retrieve( - webPageTreePath: ApplicationConstants.EXPECTED_SIGN_IN_PATH, + webPageTreePath: expectedPagePath, websiteChannelName: websiteChannelContext.WebsiteChannelName, languageName: language ); - return absoluteURl ? signInUrl.AbsoluteUrl : signInUrl.RelativePath; + // using the relative URL with Replace instead of the absolute URL to avoid having the "https" in cases when we need https + // (absolute URL always contains https) + return absoluteURL ? + signInUrl.RelativePath.Replace("~", httpRequestService.GetBaseUrl()) + : signInUrl.RelativePath; } + /// + public async Task GetSignInUrl(string language, bool absoluteURL = false) + => await GetPageUrl(ApplicationConstants.EXPECTED_SIGN_IN_PATH, language, absoluteURL); + + /// + public async Task GetRegisterUrl(string language, bool absoluteURL = false) + => await GetPageUrl(ApplicationConstants.EXPECTED_REGISTER_PATH, language, absoluteURL); + + /// public async Task UpdateMemberProfile(GuidesMember guidesMember, UpdateProfileViewModel updateProfileViewModel) { diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs index ae1c5b93..9dc52e63 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/SignIn/SignInWidgetViewComponent.cs @@ -44,7 +44,7 @@ public async Task BuildWidgetViewModel(SignInWidgetProper string redirectUrl = returnUrl ?? (redirectPage == null - ? $"/{preferredLanguageRetriever.Get()}" + ? httpRequestService.GetBaseUrlWithLanguage() : (await httpRequestService.GetPageRelativeUrl(redirectPage.WebPageGuid, preferredLanguageRetriever.Get())).Replace("~", "")); return new SignInWidgetViewModel diff --git a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs index b1ea82bc..ef99763b 100644 --- a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs +++ b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs @@ -7,6 +7,7 @@ internal static class ApplicationConstants //Membership public const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; + public const string EXPECTED_REGISTER_PATH = "/Register"; public const string ACCESS_DENIED_ACTION_PATH = "/Authentication/AccessDenied"; public const string REQUEST_RESET_PASSWORD_ACTION_PATH = "/MembershipManagement/RequestResetPassword"; public const string UPDATE_PROFILE_ACTION_PATH = "/MembershipManagement/UpdateProfile"; From f799c82209d8b9d5e0aa5f3c9a7dc23e23df2a2a Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 27 Nov 2024 11:16:23 -0500 Subject: [PATCH 58/60] GH-93 :: Continue progress on profile page --- .../cms.contentitem/profile-pn1ia5w4.xml | 17 ++++++++++ ...0-4373-8f4a-492dc9a2fb19_en@23ad9d633a.xml | 24 ++++++++++++++ ...d-46c8-a529-ff1b39b19728_en@3abd30800c.xml | 28 +++++++++++++++++ .../cms.webpageitem/contact_us@3a24980ea3.xml | 2 +- .../cookie_policy@fdaf70dc83.xml | 2 +- .../cms.webpageitem/home@0b99586e43.xml | 2 +- .../cms.webpageitem/news@8a4426a4c0.xml | 2 +- .../policy_downloads@fb51445f65.xml | 2 +- .../cms.webpageitem/products@e200480d67.xml | 2 +- .../cms.webpageitem/profile@8261ff841e.xml | 21 +++++++++++++ .../cms.webpageitem/register@e129551b80.xml | 2 +- .../reset_password@81a545c638.xml | 2 +- .../cms.webpageitem/sign_in@97331a9071.xml | 2 +- .../widget_samples@8227dadc40.xml | 2 +- .../es_profile_es@e61ec22603.xml | 31 +++++++++++++++++++ .../profile_en@b2a8e215e8.xml | 31 +++++++++++++++++++ .../9bd0f663-72ed-4000-9dd8-1c9afe0db8a4.xml | 13 ++++++++ .../Controllers/MemberManagementController.cs | 23 +++++++++----- .../Profile/ProfilePagePageTemplate.cs | 6 ++-- .../Profile/ProfilePagePageTemplate.cshtml | 3 ++ .../Membership/Profile/UpdateProfile.cshtml | 6 ++-- .../Profile/UpdateProfileForm.cshtml | 8 +---- .../Profile/UpdateProfileService.cs | 3 +- .../Profile/UpdateProfileViewComponent.cs | 2 +- .../Profile/UpdateProfileViewModel.cs | 2 -- .../Shared/Helpers/ApplicationConstants.cs | 2 +- src/TrainingGuides.Web/Program.cs | 3 +- 27 files changed, 206 insertions(+), 37 deletions(-) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/127412bd-f110-4373-8f4a-492dc9a2fb19_en@23ad9d633a.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/c4210c4c-a8dd-46c8-a529-ff1b39b19728_en@3abd30800c.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/profile@8261ff841e.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/es_profile_es@e61ec22603.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/profile_en@b2a8e215e8.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_1..4a-492dc9a2fb19_en@08771556ad/9bd0f663-72ed-4000-9dd8-1c9afe0db8a4.xml create mode 100644 src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cshtml diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml new file mode 100644 index 00000000..8e8e9f67 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml @@ -0,0 +1,17 @@ + + + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + TrainingGuides.ProfilePage + d1a0f27c-fb65-463d-8ebd-5bbbb00866f8 + cms.contenttype + + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + False + False + Profile-pn1ia5w4 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/127412bd-f110-4373-8f4a-492dc9a2fb19_en@23ad9d633a.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/127412bd-f110-4373-8f4a-492dc9a2fb19_en@23ad9d633a.xml new file mode 100644 index 00000000..eff383dc --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/127412bd-f110-4373-8f4a-492dc9a2fb19_en@23ad9d633a.xml @@ -0,0 +1,24 @@ + + + + Profile-pn1ia5w4 + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + 2024-11-27 13:57:49Z + 127412bd-f110-4373-8f4a-492dc9a2fb19 + True + 2024-11-27 13:57:49Z + + + + + + + 2 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/c4210c4c-a8dd-46c8-a529-ff1b39b19728_en@3abd30800c.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/c4210c4c-a8dd-46c8-a529-ff1b39b19728_en@3abd30800c.xml new file mode 100644 index 00000000..387d7fed --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/c4210c4c-a8dd-46c8-a529-ff1b39b19728_en@3abd30800c.xml @@ -0,0 +1,28 @@ + + + + Profile-pn1ia5w4 + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-27 13:44:36Z + Profile + c4210c4c-a8dd-46c8-a529-ff1b39b19728 + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml index e9d03ac5..a16f75fb 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/contact_us@3a24980ea3.xml @@ -7,7 +7,7 @@ 4f7e84c7-329f-413e-83d9-5923a1011ccb ContactUs-2zqcdint - 7 + 6 /Contact_us fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml index 6af2d5ec..60def807 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/cookie_policy@fdaf70dc83.xml @@ -7,7 +7,7 @@ 771d069e-e136-4a0f-880a-c0af6c8d2bdf CookiePolicy-gai183um - 8 + 7 /Cookie_policy fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml index 745a6307..b222c233 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/home@0b99586e43.xml @@ -7,7 +7,7 @@ 377ca7c4-eea9-49a0-9d58-282b5127c7ff Home-ciuaqx9l - 3 + 2 /Home fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml index bdcc3ff5..1a9cc319 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/news@8a4426a4c0.xml @@ -7,7 +7,7 @@ 77c7aa1f-e0e3-4b74-a66f-8c0c87523c15 News-bgt05j82 - 5 + 4 /News fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml index f6fdbfab..3f5f7d9f 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/policy_downloads@fb51445f65.xml @@ -7,7 +7,7 @@ 72a7df0f-c50e-42a9-a8d6-931688caca7d PolicyDownloads-jazqmswu - 6 + 5 /Policy_downloads fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml index a159e886..0004ca23 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/products@e200480d67.xml @@ -7,7 +7,7 @@ 5a0c83e1-2ad8-40b2-aa00-d01980daf01d Products-oypi95ub - 4 + 3 /Products fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/profile@8261ff841e.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/profile@8261ff841e.xml new file mode 100644 index 00000000..d4a3efee --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/profile@8261ff841e.xml @@ -0,0 +1,21 @@ + + + + Profile-pn1ia5w4 + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + cms.contentitem + + ae86b29d-4737-4503-9bb7-4558a5fd86c9 + Profile-pn1ia5w4 + 12 + /Profile + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml index 74a727b7..326abf5f 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml @@ -7,7 +7,7 @@ 9008b16a-3a70-41c9-92ba-2d289c940e2f Register-wfb2l0pn - 11 + 10 /Register fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml index d22b8c1b..017b7bac 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml @@ -7,7 +7,7 @@ 87a87bf7-17b0-403d-b751-d06dc1b64daa ResetPassword-bt12pytq - 12 + 11 /Reset_password fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml index 9e466855..60d4777e 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml @@ -7,7 +7,7 @@ 18fe09dc-c0f3-4136-863f-db59732e3658 SignIn-x4a1nygh - 10 + 9 /Sign_in fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml index b4f717b6..57bc42c8 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/widget_samples@8227dadc40.xml @@ -7,7 +7,7 @@ dc747040-b424-4f3d-9383-5f651b96415b WidgetSamples-qyagaxb2 - 9 + 8 /Widget_samples fdba40fe-1ece-4821-9d57-eaa1d89e13b1 diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/es_profile_es@e61ec22603.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/es_profile_es@e61ec22603.xml new file mode 100644 index 00000000..254220c0 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/es_profile_es@e61ec22603.xml @@ -0,0 +1,31 @@ + + + es/Profile + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + d7d73827-7055-40e2-9c2d-19f3e5396448 + + + + True + False + True + 0 + + Profile-pn1ia5w4 + ae86b29d-4737-4503-9bb7-4558a5fd86c9 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/profile_en@b2a8e215e8.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/profile_en@b2a8e215e8.xml new file mode 100644 index 00000000..3d1a59c0 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/profile_en@b2a8e215e8.xml @@ -0,0 +1,31 @@ + + + Profile + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + eecceeac-5359-4d9f-bdc0-a920a6bf4d8e + + + + True + False + True + 0 + + Profile-pn1ia5w4 + ae86b29d-4737-4503-9bb7-4558a5fd86c9 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_1..4a-492dc9a2fb19_en@08771556ad/9bd0f663-72ed-4000-9dd8-1c9afe0db8a4.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_1..4a-492dc9a2fb19_en@08771556ad/9bd0f663-72ed-4000-9dd8-1c9afe0db8a4.xml new file mode 100644 index 00000000..55635cfe --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_1..4a-492dc9a2fb19_en@08771556ad/9bd0f663-72ed-4000-9dd8-1c9afe0db8a4.xml @@ -0,0 +1,13 @@ + + + + 127412bd-f110-4373-8f4a-492dc9a2fb19 + cms.contentitemcommondata + + Profile-pn1ia5w4 + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + cms.contentitem + + + 9bd0f663-72ed-4000-9dd8-1c9afe0db8a4 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs index 8bf35853..997ce079 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs @@ -20,6 +20,7 @@ public class MemberManagementController : Controller private readonly IPreferredLanguageRetriever preferredLanguageRetriever; private const string INVALID_PASSWORD_RESET_REQUEST = "Your password reset request is expired or invalid."; + private const string LINK_STYLES = "btn tg-btn-secondary text-uppercase my-4"; public MemberManagementController(IMembershipService membershipService, IEmailService emailService, @@ -57,7 +58,7 @@ public async Task UpdateProfile(UpdateProfileViewModel model) if (result.Succeeded) { - model.SuccessMessage = stringLocalizer["Profile updated successfully."]; + return Content(GetUpdateProfileSuccessContent()); } else { @@ -67,8 +68,7 @@ public async Task UpdateProfile(UpdateProfileViewModel model) } } } - - return PartialView("~/Features/Membership/Widgets/UpdateProfile/UpdateProfileForm.cshtml", model); + return PartialView("~/Features/Membership/Profile/UpdateProfileForm.cshtml", model); } /// @@ -225,11 +225,20 @@ private async Task GetResetPasswordSuccessContent() string baseUrl = httpRequestService.GetBaseUrlWithLanguage(checkDatabaseForDefaultLanguage: true); string success = stringLocalizer["Success!"]; - string signIn = stringLocalizer["Sign in"]; - string goHome = stringLocalizer["Return to the home page"]; + string signInLinkText = stringLocalizer["Sign in"]; + string homeLinkText = stringLocalizer["Return to the home page"]; return $"
{success}
" - + $"" - + $""; + + $"" + + $""; + } + + public string GetUpdateProfileSuccessContent() + { + string success = stringLocalizer["Profile updated successfully."]; + string refreshLinkText = stringLocalizer["Refresh"]; + + return $"
{success}
" + + $""; } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs index 418e655e..d767208d 100644 --- a/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs +++ b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cs @@ -4,10 +4,10 @@ [assembly: RegisterPageTemplate( identifier: ProfilePagePageTemplate.IDENTIFIER, - name: "Article page content type template", - customViewName: "~/Features/Articles/ArticlePagePageTemplate.cshtml", + name: "Profile page content type template", + customViewName: "~/Features/Membership/Profile/ProfilePagePageTemplate.cshtml", ContentTypeNames = [ProfilePage.CONTENT_TYPE_NAME], - IconClass = "xp-a-lowercase")] + IconClass = "xp-personalisation")] namespace TrainingGuides.Web.Features.Membership.Profile; public static class ProfilePagePageTemplate diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cshtml b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cshtml new file mode 100644 index 00000000..f46d69ec --- /dev/null +++ b/src/TrainingGuides.Web/Features/Membership/Profile/ProfilePagePageTemplate.cshtml @@ -0,0 +1,3 @@ +@using TrainingGuides.Web.Features.Membership.Profile + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml index df12870c..6108ca0e 100644 --- a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfile.cshtml @@ -4,12 +4,12 @@ @model UpdateProfileViewModel @{ - string formDivId = $"updateProfileForm{Guid.NewGuid()}"; + string formDivId = $"updateProfileForm"; }

@Model.FullName

@Model.EmailAddress
-@using (Html.AjaxBeginForm("UpdateProfile", "MembershipManagement", new AjaxOptions +@using (Html.AjaxBeginForm("UpdateProfile", "MemberManagement", new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, @@ -17,6 +17,6 @@ }, new { action = $"{Model.BaseUrl}/{Model.Language}{ApplicationConstants.UPDATE_PROFILE_ACTION_PATH}" })) {
- +
} diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml index 98659e1c..c2e8cf39 100644 --- a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileForm.cshtml @@ -47,10 +47,4 @@
-
-@if (!string.IsNullOrEmpty(Model.SuccessMessage)) -{ -
- @Model.SuccessMessage -
-} \ No newline at end of file +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs index a9c4b1a7..8ea799d5 100644 --- a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileService.cs @@ -4,7 +4,7 @@ namespace TrainingGuides.Web.Features.Membership.Profile; -public class UpdateProfileService +public class UpdateProfileService : IUpdateProfileService { private readonly IHttpRequestService httpRequestService; private readonly IPreferredLanguageRetriever preferredLanguageRetriever; @@ -33,6 +33,5 @@ public UpdateProfileViewModel GetViewModel(GuidesMember guidesMember) => BaseUrl = httpRequestService.GetBaseUrl(), Language = preferredLanguageRetriever.Get(), SubmitButtonText = stringLocalizer["Submit"], - SuccessMessage = string.Empty }; } diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs index 5e76df07..3c138bc4 100644 --- a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewComponent.cs @@ -34,7 +34,7 @@ public async Task InvokeAsync() var model = updateProfileService.GetViewModel(currentMember); - return View("~/Features/Membership/ViewComponents/UpdateProfile/UpdateProfile.cshtml", model); + return View("~/Features/Membership/Profile/UpdateProfile.cshtml", model); } } diff --git a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs index 4e20bca3..c33e08d8 100644 --- a/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Profile/UpdateProfileViewModel.cs @@ -14,8 +14,6 @@ public class UpdateProfileViewModel : GuidesMemberProfileViewModel public string Language { get; set; } = string.Empty; - public string SuccessMessage { get; set; } = string.Empty; - [HiddenInput] public string SubmitButtonText { get; set; } = string.Empty; diff --git a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs index a0633a42..a000c14d 100644 --- a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs +++ b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs @@ -9,7 +9,7 @@ internal static class ApplicationConstants public const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; public const string ACCESS_DENIED_ACTION_PATH = "/Authentication/AccessDenied"; public const string REQUEST_RESET_PASSWORD_ACTION_PATH = "/MembershipManagement/RequestResetPassword"; - public const string UPDATE_PROFILE_ACTION_PATH = "/MembershipManagement/UpdateProfile"; + public const string UPDATE_PROFILE_ACTION_PATH = "/MemberManagement/UpdateProfile"; public const string PASSWORD_RESET_ACTION_PATH = "/MembershipManagement/ResetPassword"; public const string REGISTER_ACTION_PATH = "/Registration/Register"; public const string RETURN_URL_PARAMETER = "returnUrl"; diff --git a/src/TrainingGuides.Web/Program.cs b/src/TrainingGuides.Web/Program.cs index 7e46ad0c..5afaf260 100644 --- a/src/TrainingGuides.Web/Program.cs +++ b/src/TrainingGuides.Web/Program.cs @@ -47,7 +47,8 @@ ArticlePage.CONTENT_TYPE_NAME, DownloadsPage.CONTENT_TYPE_NAME, EmptyPage.CONTENT_TYPE_NAME, - ProductPage.CONTENT_TYPE_NAME + ProductPage.CONTENT_TYPE_NAME, + ProfilePage.CONTENT_TYPE_NAME } }); // Functionality related to cross-site tracking is currently disabled while we investigate an issue (#85 on GitHub) From 61f2fb78efd1270519f411f04afd4511c2b4ae81 Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 27 Nov 2024 11:16:59 -0500 Subject: [PATCH 59/60] GH-93 :: register UpdateProfileService with DI --- src/TrainingGuides.Web/ServiceCollectionExtensions.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TrainingGuides.Web/ServiceCollectionExtensions.cs b/src/TrainingGuides.Web/ServiceCollectionExtensions.cs index b99bd624..c0121fc7 100644 --- a/src/TrainingGuides.Web/ServiceCollectionExtensions.cs +++ b/src/TrainingGuides.Web/ServiceCollectionExtensions.cs @@ -6,6 +6,7 @@ using TrainingGuides.Web.Features.Shared.Services; using TrainingGuides.Web.Features.EmailNotifications; using TrainingGuides.Web.Features.Membership.Services; +using TrainingGuides.Web.Features.Membership.Profile; namespace TrainingGuides.Web; @@ -23,6 +24,7 @@ public static void AddTrainingGuidesServices(this IServiceCollection services) services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); services.AddScoped(); services.AddScoped(); From b6859adb0752d8bffc7dcfac3b9ec55403188eaa Mon Sep 17 00:00:00 2001 From: Matthew Sandstrom Date: Wed, 27 Nov 2024 13:34:08 -0500 Subject: [PATCH 60/60] GH-93 :: add localization, rearrange pages, small refactors --- .../cms.contentitem/membership-0ia66os8.xml | 17 ++++++++++ .../cms.contentitem/profile-pn1ia5w4.xml | 2 +- ...d-4cfb-a382-d3529b71e5f7_es@d153bdbc27.xml | 24 ++++++++++++++ ...5-4cb3-ad2d-5c4d278dfc68_en@9ce76c78a6.xml | 24 ++++++++++++++ ...0-4c3c-a9a7-c73537408858_es@88e10791e9.xml | 24 ++++++++++++++ ...9-4e2c-8cfc-5f3f34105c5c_es@62d0a01312.xml | 30 ++++++++++++++++++ ...8-4191-8932-8a0d1b5881fe_en@09d7fac533.xml | 28 +++++++++++++++++ ...d-4f46-bc99-f9ea95103a79_es@4610335809.xml | 28 +++++++++++++++++ .../es_membership_es@f73bd57b0f.xml | 26 ++++++++++++++++ .../es_membership_perfil_es@d04348d1ef.xml | 26 ++++++++++++++++ .../es_profile_es@7895baef5a.xml | 26 ++++++++++++++++ .../profile_en@7d97481b1f.xml | 26 ++++++++++++++++ ...s_membership_registrarse_es@631d77eff3.xml | 26 ++++++++++++++++ .../es_register_es@85fb997bd8.xml | 0 .../es_registrarse_es@f0f8739d47.xml | 26 ++++++++++++++++ .../register_en@9de4a97425.xml | 26 ++++++++++++++++ ...p_restablecer-contrasena_es@e955a88f77.xml | 26 ++++++++++++++++ ...s_restablecer-contrasena_es@f53c294f2f.xml | 26 ++++++++++++++++ .../reset-password_en@037c60027d.xml | 26 ++++++++++++++++ .../es_iniciar-sesion_es@5006c5d6a9.xml | 26 ++++++++++++++++ ...embership_iniciar-sesion_es@80ed631040.xml | 26 ++++++++++++++++ .../sign-in_en@4b6ef99399.xml | 26 ++++++++++++++++ .../cms.webpageitem/membership@3fb8d138d0.xml | 21 +++++++++++++ .../membership_profile@8261ff841e.xml} | 9 ++++-- .../membership_register@e129551b80.xml} | 9 ++++-- .../membership_reset_password@81a545c638.xml} | 9 ++++-- .../membership_sign_in@97331a9071.xml} | 9 ++++-- .../es_membresia_es@ce21fc01f1.xml | 31 +++++++++++++++++++ .../membership_en@d2b585e1d7.xml | 31 +++++++++++++++++++ .../es_membresia_perfil_es@e61ec22603.xml} | 4 +-- .../membership_profile_en@b2a8e215e8.xml} | 4 +-- ...s_membresia_registrarse_es@7bbc9f7e2a.xml} | 4 +-- .../membership_register_en@213bf2db9c.xml} | 4 +-- ..._restablecer-contrasena_es@24de890c01.xml} | 4 +-- ...mbership_reset-password_en@1ee3346e0e.xml} | 4 +-- ...embresia_iniciar-sesion_es@620b1ab686.xml} | 4 +-- .../membership_sign-in_en@563583792b.xml} | 4 +-- .../86b32ff5-65ee-42f1-a611-eda7bca08b25.xml | 13 ++++++++ .../dffe9dcb-37c9-4270-a123-275bee5703c4.xml | 13 ++++++++ .../88557395-38f6-4674-9047-2f58f8d68ea3.xml | 13 ++++++++ .../Controllers/MemberManagementController.cs | 2 +- .../Controllers/RegistrationController.cs | 14 ++++----- .../Membership/Services/MembershipService.cs | 2 -- .../ResetPassword/ResetPasswordViewModel.cs | 2 +- .../Shared/Helpers/ApplicationConstants.cs | 6 ++-- .../Resources/SharedResources.es.resx | 30 ++++++++++++++++++ 46 files changed, 722 insertions(+), 39 deletions(-) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/membership-0ia66os8.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/0d3d08f0-958d-4cfb-a382-d3529b71e5f7_es@d153bdbc27.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/3efd1159-7025-4cb3-ad2d-5c4d278dfc68_en@9ce76c78a6.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/faca5f24-8bf0-4c3c-a9a7-c73537408858_es@88e10791e9.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/76fcf370-c969-4e2c-8cfc-5f3f34105c5c_es@62d0a01312.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/bea397d8-5b18-4191-8932-8a0d1b5881fe_en@09d7fac533.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/4853a44d-1d9d-4f46-bc99-f9ea95103a79_es@4610335809.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership@ce577fc999/es_membership_es@f73bd57b0f.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_membership_perfil_es@d04348d1ef.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_profile_es@7895baef5a.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/profile_en@7d97481b1f.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_membership_registrarse_es@631d77eff3.xml rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/{register@bb7b09b4a0 => membership_register@bb7b09b4a0}/es_register_es@85fb997bd8.xml (100%) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_registrarse_es@f0f8739d47.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/register_en@9de4a97425.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_membership_restablecer-contrasena_es@e955a88f77.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_restablecer-contrasena_es@f53c294f2f.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/reset-password_en@037c60027d.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_iniciar-sesion_es@5006c5d6a9.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_membership_iniciar-sesion_es@80ed631040.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/sign-in_en@4b6ef99399.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@3fb8d138d0.xml rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/{profile@8261ff841e.xml => membership@ce577fc999/membership_profile@8261ff841e.xml} (71%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/{register@e129551b80.xml => membership@ce577fc999/membership_register@e129551b80.xml} (71%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/{reset_password@81a545c638.xml => membership@ce577fc999/membership_reset_password@81a545c638.xml} (71%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/{sign_in@97331a9071.xml => membership@ce577fc999/membership_sign_in@97331a9071.xml} (71%) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/es_membresia_es@ce21fc01f1.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/membership_en@d2b585e1d7.xml rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{profile@b4279e1364/es_profile_es@e61ec22603.xml => membership_profile@b4279e1364/es_membresia_perfil_es@e61ec22603.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{profile@b4279e1364/profile_en@b2a8e215e8.xml => membership_profile@b4279e1364/membership_profile_en@b2a8e215e8.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{register@bb7b09b4a0/es_registrarse_es@7bbc9f7e2a.xml => membership_register@bb7b09b4a0/es_membresia_registrarse_es@7bbc9f7e2a.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{register@bb7b09b4a0/register_en@213bf2db9c.xml => membership_register@bb7b09b4a0/membership_register_en@213bf2db9c.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml => membership_reset_password@25f0dc45a5/es_membresia_restablecer-contrasena_es@24de890c01.xml} (88%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml => membership_reset_password@25f0dc45a5/membership_reset-password_en@1ee3346e0e.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{sign_in@4968a19c91/es_iniciar-sesion_es@620b1ab686.xml => membership_sign_in@4968a19c91/es_membresia_iniciar-sesion_es@620b1ab686.xml} (89%) rename src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/{sign_in@4968a19c91/sign-in_en@563583792b.xml => membership_sign_in@4968a19c91/membership_sign-in_en@563583792b.xml} (89%) create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..2d-5c4d278dfc68_en@3d79d8bb5c/86b32ff5-65ee-42f1-a611-eda7bca08b25.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..82-d3529b71e5f7_es@6e765807b7/dffe9dcb-37c9-4270-a123-275bee5703c4.xml create mode 100644 src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_f..a7-c73537408858_es@e75b3ea7be/88557395-38f6-4674-9047-2f58f8d68ea3.xml diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/membership-0ia66os8.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/membership-0ia66os8.xml new file mode 100644 index 00000000..93ff4748 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/membership-0ia66os8.xml @@ -0,0 +1,17 @@ + + + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + TrainingGuides.EmptyPage + 58018c9d-5b6c-4251-b3a8-8c1a6d124780 + cms.contenttype + + af7304be-f23d-427a-bf6d-0261b04d15f6 + False + False + Membership-0ia66os8 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml index 8e8e9f67..ab2d0932 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitem/profile-pn1ia5w4.xml @@ -12,6 +12,6 @@ ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 False - False + True Profile-pn1ia5w4 \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/0d3d08f0-958d-4cfb-a382-d3529b71e5f7_es@d153bdbc27.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/0d3d08f0-958d-4cfb-a382-d3529b71e5f7_es@d153bdbc27.xml new file mode 100644 index 00000000..ba87301f --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/0d3d08f0-958d-4cfb-a382-d3529b71e5f7_es@d153bdbc27.xml @@ -0,0 +1,24 @@ + + + + Membership-0ia66os8 + af7304be-f23d-427a-bf6d-0261b04d15f6 + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 2024-11-27 16:56:37Z + 0d3d08f0-958d-4cfb-a382-d3529b71e5f7 + True + 2024-11-27 16:58:10Z + + Membresía"},"fieldIdentifiers":{"content":"7b1fcff8-e456-4971-ad65-67d9dc669566"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"4746a8ce-04b7-41a6-ab4f-f49806cfc35c","colorScheme":"890b5d4b-da95-40c3-a9ca-53436543923a","cornerStyle":"0d06e934-deb3-413d-9dce-bcb55cb68cca","columnLayout":"55da752b-cf97-4e3c-86f8-1bc64175fde0"}},{"identifier":"dc49f96c-1ac6-4347-b712-ab46b42a7134","type":"TrainingGuides.GeneralSection","properties":{"sectionAnchor":"","colorScheme":"TransparentDark","cornerStyle":"Round","columnLayout":"ThreeColumnSmLgSm"},"zones":[{"identifier":"ed7f1845-9be5-40fe-9e05-500a1541d451","name":"zoneSecondary","widgets":[{"identifier":"6aebb90e-f026-4100-bef8-090a650c4a8f","type":"Kentico.Widget.RichText","variants":[{"identifier":"b4a80d3f-ff35-4605-9d09-bac86d658f49","properties":{"content":"

Inicie sesión en su cuenta

"},"fieldIdentifiers":{"content":"7994f147-869d-469f-8454-a1b8cad749a5"}}]},{"identifier":"d06613ff-d996-45df-b7c9-7c9ff359f50d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"9d384979-614d-41a5-87a7-162380fe678d","properties":{"unauthenticatedText":"","unauthenticatedButtonText":"Iniciar sesión","unauthenticatedTargetContentPage":[{"webPageGuid":"18fe09dc-c0f3-4136-863f-db59732e3658"}],"authenticatedText":"Ya ha iniciado sesión.","authenticatedButtonText":"Cerrar sesión"},"fieldIdentifiers":{"unauthenticatedText":"18d0fe2d-cc6e-4568-ac1d-860db04eca38","unauthenticatedButtonText":"08eea16d-1021-449f-a9d7-3fbeea89f40f","unauthenticatedTargetContentPage":"592f20d1-01e2-4ebb-b73f-e3cca737340e","authenticatedText":"5ca82e96-5c1b-4dcf-b6b7-de8108836718","authenticatedButtonText":"d2f429a8-04d3-4eae-b75b-ed0da24462e2"}}]}]},{"identifier":"b35a720d-aa06-48e0-9a61-071c7a0c2ad9","name":"zoneMain","widgets":[{"identifier":"194ec12b-101a-485c-9030-ff508de2c734","type":"Kentico.Widget.RichText","variants":[{"identifier":"3c76be4d-307b-4c6f-88b0-5d6f7d1c78b7","properties":{"content":"

Administre su cuenta

"},"fieldIdentifiers":{"content":"3fb55ec9-c2a7-4537-bfcc-1fba9f0c15e0"}}]},{"identifier":"d6f9913e-fa6f-4aff-a25f-5d2ba84155c0","type":"TrainingGuides.SimpleCallToActionWidget","variants":[{"identifier":"033b19c6-f3e2-4a98-8697-fe799a80d38e","properties":{"text":"Perfil","targetContent":"Page","targetContentPage":[{"webPageGuid":"ae86b29d-4737-4503-9bb7-4558a5fd86c9"}],"targetContentAbsoluteUrl":"","openInNewTab":false},"fieldIdentifiers":{"text":"a451a192-469a-48ae-ad90-2854c469a753","targetContent":"584829bd-6858-4794-90d7-18bc0a3edd9c","targetContentPage":"ac455ea3-2ea6-4bad-b872-5069506f771a","targetContentAbsoluteUrl":"cf699bd0-9134-47d0-b2a5-b59eb8c38d02","openInNewTab":"ca1a9c7b-ea2d-490a-8148-e93ad25eb2df"}}]},{"identifier":"f299d4af-df9a-455f-82f9-33d30c8b37cf","type":"TrainingGuides.SimpleCallToActionWidget","variants":[{"identifier":"510d83e9-8b03-4a75-a742-d0bfd14f6567","properties":{"text":"Restablecer contraseña","targetContent":"Page","targetContentPage":[{"webPageGuid":"87a87bf7-17b0-403d-b751-d06dc1b64daa"}],"targetContentAbsoluteUrl":"","openInNewTab":false},"fieldIdentifiers":{"text":"5007c223-4e74-46ce-ba7f-a3fd664949c7","targetContent":"db27d7be-19ae-4fe3-8414-6ca4852a2512","targetContentPage":"681fd352-6465-453a-a27b-c1b18acd991d","targetContentAbsoluteUrl":"749ed621-0d8a-42a3-b125-861c9b25db67","openInNewTab":"93b1ce19-a018-4a2d-bc6a-4d044c73df62"}}]}]},{"identifier":"768440d6-cee1-4313-a7a9-cf63a96f1d89","name":"zoneTertiary","widgets":[{"identifier":"17084fdd-2414-4447-9905-be22a26fcdac","type":"Kentico.Widget.RichText","variants":[{"identifier":"56c84e8f-40e7-4ace-a16a-7967a3a7aa4f","properties":{"content":"

Cree una cuenta

"},"fieldIdentifiers":{"content":"789f10a2-67c7-48ed-9bb4-ba465a365f5d"}}]},{"identifier":"b241799e-ce64-4c4e-a4d1-aed407880963","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fa9b35a4-3f21-4723-a8ca-f4587db32837","properties":{"unauthenticatedText":"","unauthenticatedButtonText":"Registrarse","unauthenticatedTargetContentPage":[{"webPageGuid":"9008b16a-3a70-41c9-92ba-2d289c940e2f"}],"authenticatedText":"Ya se ha registrado.","authenticatedButtonText":"Cerrar sesión"},"fieldIdentifiers":{"unauthenticatedText":"d67e50ca-4f2a-4eb2-a22e-30a82d7278b6","unauthenticatedButtonText":"a0946965-57ee-431a-a761-5c069c77b017","unauthenticatedTargetContentPage":"cf115d79-0aeb-4cd3-8e84-1b289efa0385","authenticatedText":"cc1c84c8-1274-40cf-ae57-2f4711176d88","authenticatedButtonText":"09b8b9df-7576-4d6f-800a-7c463b77373b"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9e011f83-c2c7-412c-9a40-8ac65f772af5","colorScheme":"63c0fd9f-37d0-4834-9a17-8443913efe92","cornerStyle":"6f6a4ccf-3f92-4842-abc8-6b5994288f21","columnLayout":"02873190-66b9-4a0a-9edb-e15e792a6322"}}]}]}]]> +
+ + + + 2 +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/3efd1159-7025-4cb3-ad2d-5c4d278dfc68_en@9ce76c78a6.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/3efd1159-7025-4cb3-ad2d-5c4d278dfc68_en@9ce76c78a6.xml new file mode 100644 index 00000000..6569cbc2 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/membership-0ia66os8@a34595779d/3efd1159-7025-4cb3-ad2d-5c4d278dfc68_en@9ce76c78a6.xml @@ -0,0 +1,24 @@ + + + + Membership-0ia66os8 + af7304be-f23d-427a-bf6d-0261b04d15f6 + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + 2024-11-27 16:47:11Z + 3efd1159-7025-4cb3-ad2d-5c4d278dfc68 + True + 2024-11-27 16:51:08Z + + Membership"},"fieldIdentifiers":{"content":"7b1fcff8-e456-4971-ad65-67d9dc669566"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"4746a8ce-04b7-41a6-ab4f-f49806cfc35c","colorScheme":"890b5d4b-da95-40c3-a9ca-53436543923a","cornerStyle":"0d06e934-deb3-413d-9dce-bcb55cb68cca","columnLayout":"55da752b-cf97-4e3c-86f8-1bc64175fde0"}},{"identifier":"dc49f96c-1ac6-4347-b712-ab46b42a7134","type":"TrainingGuides.GeneralSection","properties":{"sectionAnchor":"","colorScheme":"TransparentDark","cornerStyle":"Round","columnLayout":"ThreeColumnSmLgSm"},"zones":[{"identifier":"ed7f1845-9be5-40fe-9e05-500a1541d451","name":"zoneSecondary","widgets":[{"identifier":"6aebb90e-f026-4100-bef8-090a650c4a8f","type":"Kentico.Widget.RichText","variants":[{"identifier":"b4a80d3f-ff35-4605-9d09-bac86d658f49","properties":{"content":"

Sign in to your account

"},"fieldIdentifiers":{"content":"7994f147-869d-469f-8454-a1b8cad749a5"}}]},{"identifier":"d06613ff-d996-45df-b7c9-7c9ff359f50d","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"9d384979-614d-41a5-87a7-162380fe678d","properties":{"unauthenticatedText":"","unauthenticatedButtonText":"Sign in","unauthenticatedTargetContentPage":[{"webPageGuid":"18fe09dc-c0f3-4136-863f-db59732e3658"}],"authenticatedText":"You are already signed in","authenticatedButtonText":"Sign out"},"fieldIdentifiers":{"unauthenticatedText":"18d0fe2d-cc6e-4568-ac1d-860db04eca38","unauthenticatedButtonText":"08eea16d-1021-449f-a9d7-3fbeea89f40f","unauthenticatedTargetContentPage":"592f20d1-01e2-4ebb-b73f-e3cca737340e","authenticatedText":"5ca82e96-5c1b-4dcf-b6b7-de8108836718","authenticatedButtonText":"d2f429a8-04d3-4eae-b75b-ed0da24462e2"}}]}]},{"identifier":"b35a720d-aa06-48e0-9a61-071c7a0c2ad9","name":"zoneMain","widgets":[{"identifier":"194ec12b-101a-485c-9030-ff508de2c734","type":"Kentico.Widget.RichText","variants":[{"identifier":"3c76be4d-307b-4c6f-88b0-5d6f7d1c78b7","properties":{"content":"

Manage your account

"},"fieldIdentifiers":{"content":"3fb55ec9-c2a7-4537-bfcc-1fba9f0c15e0"}}]},{"identifier":"d6f9913e-fa6f-4aff-a25f-5d2ba84155c0","type":"TrainingGuides.SimpleCallToActionWidget","variants":[{"identifier":"033b19c6-f3e2-4a98-8697-fe799a80d38e","properties":{"text":"Profile","targetContent":"Page","targetContentPage":[{"webPageGuid":"ae86b29d-4737-4503-9bb7-4558a5fd86c9"}],"targetContentAbsoluteUrl":"","openInNewTab":false},"fieldIdentifiers":{"text":"a451a192-469a-48ae-ad90-2854c469a753","targetContent":"584829bd-6858-4794-90d7-18bc0a3edd9c","targetContentPage":"ac455ea3-2ea6-4bad-b872-5069506f771a","targetContentAbsoluteUrl":"cf699bd0-9134-47d0-b2a5-b59eb8c38d02","openInNewTab":"ca1a9c7b-ea2d-490a-8148-e93ad25eb2df"}}]},{"identifier":"f299d4af-df9a-455f-82f9-33d30c8b37cf","type":"TrainingGuides.SimpleCallToActionWidget","variants":[{"identifier":"510d83e9-8b03-4a75-a742-d0bfd14f6567","properties":{"text":"Reset password","targetContent":"Page","targetContentPage":[{"webPageGuid":"87a87bf7-17b0-403d-b751-d06dc1b64daa"}],"targetContentAbsoluteUrl":"","openInNewTab":false},"fieldIdentifiers":{"text":"5007c223-4e74-46ce-ba7f-a3fd664949c7","targetContent":"db27d7be-19ae-4fe3-8414-6ca4852a2512","targetContentPage":"681fd352-6465-453a-a27b-c1b18acd991d","targetContentAbsoluteUrl":"749ed621-0d8a-42a3-b125-861c9b25db67","openInNewTab":"93b1ce19-a018-4a2d-bc6a-4d044c73df62"}}]}]},{"identifier":"768440d6-cee1-4313-a7a9-cf63a96f1d89","name":"zoneTertiary","widgets":[{"identifier":"17084fdd-2414-4447-9905-be22a26fcdac","type":"Kentico.Widget.RichText","variants":[{"identifier":"56c84e8f-40e7-4ace-a16a-7967a3a7aa4f","properties":{"content":"

Create an account

"},"fieldIdentifiers":{"content":"789f10a2-67c7-48ed-9bb4-ba465a365f5d"}}]},{"identifier":"b241799e-ce64-4c4e-a4d1-aed407880963","type":"TrainingGuides.LinkOrSignOutWidget","variants":[{"identifier":"fa9b35a4-3f21-4723-a8ca-f4587db32837","properties":{"unauthenticatedText":"","unauthenticatedButtonText":"Register","unauthenticatedTargetContentPage":[{"webPageGuid":"9008b16a-3a70-41c9-92ba-2d289c940e2f"}],"authenticatedText":"You are already registered","authenticatedButtonText":"Sign out"},"fieldIdentifiers":{"unauthenticatedText":"d67e50ca-4f2a-4eb2-a22e-30a82d7278b6","unauthenticatedButtonText":"a0946965-57ee-431a-a761-5c069c77b017","unauthenticatedTargetContentPage":"cf115d79-0aeb-4cd3-8e84-1b289efa0385","authenticatedText":"cc1c84c8-1274-40cf-ae57-2f4711176d88","authenticatedButtonText":"09b8b9df-7576-4d6f-800a-7c463b77373b"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"9e011f83-c2c7-412c-9a40-8ac65f772af5","colorScheme":"63c0fd9f-37d0-4834-9a17-8443913efe92","cornerStyle":"6f6a4ccf-3f92-4842-abc8-6b5994288f21","columnLayout":"02873190-66b9-4a0a-9edb-e15e792a6322"}}]}]}]]> +
+ + + + 2 +
\ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/faca5f24-8bf0-4c3c-a9a7-c73537408858_es@88e10791e9.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/faca5f24-8bf0-4c3c-a9a7-c73537408858_es@88e10791e9.xml new file mode 100644 index 00000000..124334bf --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemcommondata/profile-pn1ia5w4@218351b3cf/faca5f24-8bf0-4c3c-a9a7-c73537408858_es@88e10791e9.xml @@ -0,0 +1,24 @@ + + + + Profile-pn1ia5w4 + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + 2024-11-27 16:57:38Z + faca5f24-8bf0-4c3c-a9a7-c73537408858 + True + 2024-11-27 16:57:38Z + + + + + + + 2 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/76fcf370-c969-4e2c-8cfc-5f3f34105c5c_es@62d0a01312.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/76fcf370-c969-4e2c-8cfc-5f3f34105c5c_es@62d0a01312.xml new file mode 100644 index 00000000..0f347440 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/76fcf370-c969-4e2c-8cfc-5f3f34105c5c_es@62d0a01312.xml @@ -0,0 +1,30 @@ + + + + Membership-0ia66os8 + af7304be-f23d-427a-bf6d-0261b04d15f6 + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-27 16:52:45Z + + + + 76fcf370-c969-4e2c-8cfc-5f3f34105c5c + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/bea397d8-5b18-4191-8932-8a0d1b5881fe_en@09d7fac533.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/bea397d8-5b18-4191-8932-8a0d1b5881fe_en@09d7fac533.xml new file mode 100644 index 00000000..0504a41f --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/membership-0ia66os8@a34595779d/bea397d8-5b18-4191-8932-8a0d1b5881fe_en@09d7fac533.xml @@ -0,0 +1,28 @@ + + + + Membership-0ia66os8 + af7304be-f23d-427a-bf6d-0261b04d15f6 + cms.contentitem + + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-27 16:32:51Z + Membership + bea397d8-5b18-4191-8932-8a0d1b5881fe + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/4853a44d-1d9d-4f46-bc99-f9ea95103a79_es@4610335809.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/4853a44d-1d9d-4f46-bc99-f9ea95103a79_es@4610335809.xml new file mode 100644 index 00000000..cb292a8e --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.contentitemlanguagemetadata/profile-pn1ia5w4@218351b3cf/4853a44d-1d9d-4f46-bc99-f9ea95103a79_es@4610335809.xml @@ -0,0 +1,28 @@ + + + + Profile-pn1ia5w4 + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + cms.contentitem + + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + 2024-11-27 16:57:35Z + Perfil + 4853a44d-1d9d-4f46-bc99-f9ea95103a79 + False + 2 + + administrator + 6415b8ce-8072-4bcd-8e48-9d7178b826b7 + cms.user + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership@ce577fc999/es_membership_es@f73bd57b0f.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership@ce577fc999/es_membership_es@f73bd57b0f.xml new file mode 100644 index 00000000..ed4fda8a --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership@ce577fc999/es_membership_es@f73bd57b0f.xml @@ -0,0 +1,26 @@ + + + es/Membership + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + Membership-0ia66os8 + 78f7f287-494e-4a23-a562-20c3e7a9a638 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_membership_perfil_es@d04348d1ef.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_membership_perfil_es@d04348d1ef.xml new file mode 100644 index 00000000..4f5841f7 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_membership_perfil_es@d04348d1ef.xml @@ -0,0 +1,26 @@ + + + es/Membership/Perfil + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + Profile-pn1ia5w4 + ae86b29d-4737-4503-9bb7-4558a5fd86c9 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_profile_es@7895baef5a.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_profile_es@7895baef5a.xml new file mode 100644 index 00000000..352f37c1 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/es_profile_es@7895baef5a.xml @@ -0,0 +1,26 @@ + + + es/Profile + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + Profile-pn1ia5w4 + ae86b29d-4737-4503-9bb7-4558a5fd86c9 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/profile_en@7d97481b1f.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/profile_en@7d97481b1f.xml new file mode 100644 index 00000000..e3b77877 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_profile@b4279e1364/profile_en@7d97481b1f.xml @@ -0,0 +1,26 @@ + + + Profile + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + + + + Profile-pn1ia5w4 + ae86b29d-4737-4503-9bb7-4558a5fd86c9 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_membership_registrarse_es@631d77eff3.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_membership_registrarse_es@631d77eff3.xml new file mode 100644 index 00000000..41bb76a5 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_membership_registrarse_es@631d77eff3.xml @@ -0,0 +1,26 @@ + + + es/Membership/Registrarse + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + Register-wfb2l0pn + 9008b16a-3a70-41c9-92ba-2d289c940e2f + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/register@bb7b09b4a0/es_register_es@85fb997bd8.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_register_es@85fb997bd8.xml similarity index 100% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/register@bb7b09b4a0/es_register_es@85fb997bd8.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_register_es@85fb997bd8.xml diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_registrarse_es@f0f8739d47.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_registrarse_es@f0f8739d47.xml new file mode 100644 index 00000000..01602490 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/es_registrarse_es@f0f8739d47.xml @@ -0,0 +1,26 @@ + + + es/Registrarse + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + Register-wfb2l0pn + 9008b16a-3a70-41c9-92ba-2d289c940e2f + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/register_en@9de4a97425.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/register_en@9de4a97425.xml new file mode 100644 index 00000000..b9093f95 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_register@bb7b09b4a0/register_en@9de4a97425.xml @@ -0,0 +1,26 @@ + + + Register + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + + + + Register-wfb2l0pn + 9008b16a-3a70-41c9-92ba-2d289c940e2f + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_membership_restablecer-contrasena_es@e955a88f77.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_membership_restablecer-contrasena_es@e955a88f77.xml new file mode 100644 index 00000000..e079a236 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_membership_restablecer-contrasena_es@e955a88f77.xml @@ -0,0 +1,26 @@ + + + es/Membership/Restablecer-contrasena + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + ResetPassword-bt12pytq + 87a87bf7-17b0-403d-b751-d06dc1b64daa + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_restablecer-contrasena_es@f53c294f2f.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_restablecer-contrasena_es@f53c294f2f.xml new file mode 100644 index 00000000..07eb4739 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/es_restablecer-contrasena_es@f53c294f2f.xml @@ -0,0 +1,26 @@ + + + es/Restablecer-contrasena + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + ResetPassword-bt12pytq + 87a87bf7-17b0-403d-b751-d06dc1b64daa + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/reset-password_en@037c60027d.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/reset-password_en@037c60027d.xml new file mode 100644 index 00000000..d4b85d78 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_reset_password@25f0dc45a5/reset-password_en@037c60027d.xml @@ -0,0 +1,26 @@ + + + Reset-password + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + + + + ResetPassword-bt12pytq + 87a87bf7-17b0-403d-b751-d06dc1b64daa + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_iniciar-sesion_es@5006c5d6a9.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_iniciar-sesion_es@5006c5d6a9.xml new file mode 100644 index 00000000..7f8028e1 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_iniciar-sesion_es@5006c5d6a9.xml @@ -0,0 +1,26 @@ + + + es/Iniciar-sesion + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + SignIn-x4a1nygh + 18fe09dc-c0f3-4136-863f-db59732e3658 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_membership_iniciar-sesion_es@80ed631040.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_membership_iniciar-sesion_es@80ed631040.xml new file mode 100644 index 00000000..1d13bb8b --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/es_membership_iniciar-sesion_es@80ed631040.xml @@ -0,0 +1,26 @@ + + + es/Membership/Iniciar-sesion + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + + + + + SignIn-x4a1nygh + 18fe09dc-c0f3-4136-863f-db59732e3658 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/sign-in_en@4b6ef99399.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/sign-in_en@4b6ef99399.xml new file mode 100644 index 00000000..14187344 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageformerurlpath/membership_sign_in@4968a19c91/sign-in_en@4b6ef99399.xml @@ -0,0 +1,26 @@ + + + Sign-in + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + + + + + SignIn-x4a1nygh + 18fe09dc-c0f3-4136-863f-db59732e3658 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@3fb8d138d0.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@3fb8d138d0.xml new file mode 100644 index 00000000..14247b3e --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@3fb8d138d0.xml @@ -0,0 +1,21 @@ + + + + Membership-0ia66os8 + af7304be-f23d-427a-bf6d-0261b04d15f6 + cms.contentitem + + 78f7f287-494e-4a23-a562-20c3e7a9a638 + Membership-0ia66os8 + 9 + /Membership + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/profile@8261ff841e.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_profile@8261ff841e.xml similarity index 71% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/profile@8261ff841e.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_profile@8261ff841e.xml index d4a3efee..75c3f7a3 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/profile@8261ff841e.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_profile@8261ff841e.xml @@ -7,8 +7,13 @@ ae86b29d-4737-4503-9bb7-4558a5fd86c9 Profile-pn1ia5w4 - 12 - /Profile + 5 + + Membership-0ia66os8 + 78f7f287-494e-4a23-a562-20c3e7a9a638 + cms.webpageitem + + /Membership/Profile fdba40fe-1ece-4821-9d57-eaa1d89e13b1 cms.websitechannel diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_register@e129551b80.xml similarity index 71% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_register@e129551b80.xml index 326abf5f..28ee73db 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/register@e129551b80.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_register@e129551b80.xml @@ -7,8 +7,13 @@ 9008b16a-3a70-41c9-92ba-2d289c940e2f Register-wfb2l0pn - 10 - /Register + 3 + + Membership-0ia66os8 + 78f7f287-494e-4a23-a562-20c3e7a9a638 + cms.webpageitem + + /Membership/Register fdba40fe-1ece-4821-9d57-eaa1d89e13b1 cms.websitechannel diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_reset_password@81a545c638.xml similarity index 71% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_reset_password@81a545c638.xml index 017b7bac..ec13dae8 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/reset_password@81a545c638.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_reset_password@81a545c638.xml @@ -7,8 +7,13 @@ 87a87bf7-17b0-403d-b751-d06dc1b64daa ResetPassword-bt12pytq - 11 - /Reset_password + 4 + + Membership-0ia66os8 + 78f7f287-494e-4a23-a562-20c3e7a9a638 + cms.webpageitem + + /Membership/Reset_password fdba40fe-1ece-4821-9d57-eaa1d89e13b1 cms.websitechannel diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_sign_in@97331a9071.xml similarity index 71% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_sign_in@97331a9071.xml index 60d4777e..7ca4fcb3 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/sign_in@97331a9071.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageitem/membership@ce577fc999/membership_sign_in@97331a9071.xml @@ -7,8 +7,13 @@ 18fe09dc-c0f3-4136-863f-db59732e3658 SignIn-x4a1nygh - 9 - /Sign_in + 2 + + Membership-0ia66os8 + 78f7f287-494e-4a23-a562-20c3e7a9a638 + cms.webpageitem + + /Membership/Sign_in fdba40fe-1ece-4821-9d57-eaa1d89e13b1 cms.websitechannel diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/es_membresia_es@ce21fc01f1.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/es_membresia_es@ce21fc01f1.xml new file mode 100644 index 00000000..720bbf44 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/es_membresia_es@ce21fc01f1.xml @@ -0,0 +1,31 @@ + + + es/Membresia + + es + b2e99971-c2dd-4a47-bb64-0d9a0d28d226 + cms.contentlanguage + + bdaf0f3a-6f5c-4f3c-98a4-60c788a8bd0e + + + + True + False + True + 0 + + Membership-0ia66os8 + 78f7f287-494e-4a23-a562-20c3e7a9a638 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/membership_en@d2b585e1d7.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/membership_en@d2b585e1d7.xml new file mode 100644 index 00000000..e1c6f070 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership@ce577fc999/membership_en@d2b585e1d7.xml @@ -0,0 +1,31 @@ + + + Membership + + en + e81b5172-f240-4041-88b1-653089984e29 + cms.contentlanguage + + 2d2fd1f9-a54f-4ba6-8bee-e770a28bd4db + + + + True + False + True + 0 + + Membership-0ia66os8 + 78f7f287-494e-4a23-a562-20c3e7a9a638 + cms.webpageitem + + + fdba40fe-1ece-4821-9d57-eaa1d89e13b1 + cms.websitechannel + + TrainingGuidesPages + 5ba9c1e8-b61e-4570-b666-87a9b92bbe3b + cms.channel + + + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/es_profile_es@e61ec22603.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_profile@b4279e1364/es_membresia_perfil_es@e61ec22603.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/es_profile_es@e61ec22603.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_profile@b4279e1364/es_membresia_perfil_es@e61ec22603.xml index 254220c0..45daa86f 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/es_profile_es@e61ec22603.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_profile@b4279e1364/es_membresia_perfil_es@e61ec22603.xml @@ -1,6 +1,6 @@  - es/Profile + es/Membresia/Perfil es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ d7d73827-7055-40e2-9c2d-19f3e5396448 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/profile_en@b2a8e215e8.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_profile@b4279e1364/membership_profile_en@b2a8e215e8.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/profile_en@b2a8e215e8.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_profile@b4279e1364/membership_profile_en@b2a8e215e8.xml index 3d1a59c0..81e7915f 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/profile@b4279e1364/profile_en@b2a8e215e8.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_profile@b4279e1364/membership_profile_en@b2a8e215e8.xml @@ -1,6 +1,6 @@  - Profile + Membership/Profile en e81b5172-f240-4041-88b1-653089984e29 @@ -8,7 +8,7 @@ eecceeac-5359-4d9f-bdc0-a920a6bf4d8e - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_registrarse_es@7bbc9f7e2a.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_register@bb7b09b4a0/es_membresia_registrarse_es@7bbc9f7e2a.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_registrarse_es@7bbc9f7e2a.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_register@bb7b09b4a0/es_membresia_registrarse_es@7bbc9f7e2a.xml index 90282154..6c14799d 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/es_registrarse_es@7bbc9f7e2a.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_register@bb7b09b4a0/es_membresia_registrarse_es@7bbc9f7e2a.xml @@ -1,6 +1,6 @@  - es/Registrarse + es/Membresia/Registrarse es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ 265f57e1-a961-45e7-9119-867782ae0ea6 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/register_en@213bf2db9c.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_register@bb7b09b4a0/membership_register_en@213bf2db9c.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/register_en@213bf2db9c.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_register@bb7b09b4a0/membership_register_en@213bf2db9c.xml index 3d16cc9d..3048920a 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/register@bb7b09b4a0/register_en@213bf2db9c.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_register@bb7b09b4a0/membership_register_en@213bf2db9c.xml @@ -1,6 +1,6 @@  - Register + Membership/Register en e81b5172-f240-4041-88b1-653089984e29 @@ -8,7 +8,7 @@ f4a8cc70-29a4-48ac-b816-0d38abd62d5e - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_reset_password@25f0dc45a5/es_membresia_restablecer-contrasena_es@24de890c01.xml similarity index 88% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_reset_password@25f0dc45a5/es_membresia_restablecer-contrasena_es@24de890c01.xml index 80c4a186..84d1fff6 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/es_restablecer-contrasena_es@24de890c01.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_reset_password@25f0dc45a5/es_membresia_restablecer-contrasena_es@24de890c01.xml @@ -1,6 +1,6 @@  - es/Restablecer-contrasena + es/Membresia/Restablecer-contrasena es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ bb1216d6-6453-4336-be03-52ef7e740319 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_reset_password@25f0dc45a5/membership_reset-password_en@1ee3346e0e.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_reset_password@25f0dc45a5/membership_reset-password_en@1ee3346e0e.xml index 383562f7..84ed6f3c 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/reset_password@25f0dc45a5/reset-password_en@1ee3346e0e.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_reset_password@25f0dc45a5/membership_reset-password_en@1ee3346e0e.xml @@ -1,6 +1,6 @@  - Reset-password + Membership/Reset-password en e81b5172-f240-4041-88b1-653089984e29 @@ -8,7 +8,7 @@ b5552221-6c08-417b-9210-9bd386c2f89f - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_iniciar-sesion_es@620b1ab686.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_sign_in@4968a19c91/es_membresia_iniciar-sesion_es@620b1ab686.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_iniciar-sesion_es@620b1ab686.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_sign_in@4968a19c91/es_membresia_iniciar-sesion_es@620b1ab686.xml index 08abb52d..6053c69e 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/es_iniciar-sesion_es@620b1ab686.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_sign_in@4968a19c91/es_membresia_iniciar-sesion_es@620b1ab686.xml @@ -1,6 +1,6 @@  - es/Iniciar-sesion + es/Membresia/Iniciar-sesion es b2e99971-c2dd-4a47-bb64-0d9a0d28d226 @@ -8,7 +8,7 @@ a7bbb92d-4ea8-4d71-b99e-852098ccd504 - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/sign-in_en@563583792b.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_sign_in@4968a19c91/membership_sign-in_en@563583792b.xml similarity index 89% rename from src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/sign-in_en@563583792b.xml rename to src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_sign_in@4968a19c91/membership_sign-in_en@563583792b.xml index e491b536..477819a5 100644 --- a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/sign_in@4968a19c91/sign-in_en@563583792b.xml +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/cms.webpageurlpath/membership_sign_in@4968a19c91/membership_sign-in_en@563583792b.xml @@ -1,6 +1,6 @@  - Sign-in + Membership/Sign-in en e81b5172-f240-4041-88b1-653089984e29 @@ -8,7 +8,7 @@ 59486e9d-e407-46e7-9982-18162f98a38e - + True False diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..2d-5c4d278dfc68_en@3d79d8bb5c/86b32ff5-65ee-42f1-a611-eda7bca08b25.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..2d-5c4d278dfc68_en@3d79d8bb5c/86b32ff5-65ee-42f1-a611-eda7bca08b25.xml new file mode 100644 index 00000000..76c31849 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..2d-5c4d278dfc68_en@3d79d8bb5c/86b32ff5-65ee-42f1-a611-eda7bca08b25.xml @@ -0,0 +1,13 @@ + + + + 3efd1159-7025-4cb3-ad2d-5c4d278dfc68 + cms.contentitemcommondata + + Membership-0ia66os8 + af7304be-f23d-427a-bf6d-0261b04d15f6 + cms.contentitem + + + 86b32ff5-65ee-42f1-a611-eda7bca08b25 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..82-d3529b71e5f7_es@6e765807b7/dffe9dcb-37c9-4270-a123-275bee5703c4.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..82-d3529b71e5f7_es@6e765807b7/dffe9dcb-37c9-4270-a123-275bee5703c4.xml new file mode 100644 index 00000000..40c3211d --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.emptypage/membership-0ia66os..82-d3529b71e5f7_es@6e765807b7/dffe9dcb-37c9-4270-a123-275bee5703c4.xml @@ -0,0 +1,13 @@ + + + + 0d3d08f0-958d-4cfb-a382-d3529b71e5f7 + cms.contentitemcommondata + + Membership-0ia66os8 + af7304be-f23d-427a-bf6d-0261b04d15f6 + cms.contentitem + + + dffe9dcb-37c9-4270-a123-275bee5703c4 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_f..a7-c73537408858_es@e75b3ea7be/88557395-38f6-4674-9047-2f58f8d68ea3.xml b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_f..a7-c73537408858_es@e75b3ea7be/88557395-38f6-4674-9047-2f58f8d68ea3.xml new file mode 100644 index 00000000..49f670a3 --- /dev/null +++ b/src/TrainingGuides.Web/App_Data/CIRepository/TrainingGuidesPages/contentitemdata.trainingguides.profilepage/profile-pn1ia5w4_f..a7-c73537408858_es@e75b3ea7be/88557395-38f6-4674-9047-2f58f8d68ea3.xml @@ -0,0 +1,13 @@ + + + + faca5f24-8bf0-4c3c-a9a7-c73537408858 + cms.contentitemcommondata + + Profile-pn1ia5w4 + ecca8e9a-945b-48c1-8a4a-17c7422a0ae6 + cms.contentitem + + + 88557395-38f6-4674-9047-2f58f8d68ea3 + \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs index 0bde5dbe..58b7034f 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/MemberManagementController.cs @@ -239,6 +239,6 @@ public string GetUpdateProfileSuccessContent() string refreshLinkText = stringLocalizer["Refresh"]; return $"
{success}
" - + $""; + + $""; } } \ No newline at end of file diff --git a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs index 38ad833e..43b64290 100644 --- a/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs +++ b/src/TrainingGuides.Web/Features/Membership/Controllers/RegistrationController.cs @@ -94,10 +94,10 @@ private ActionResult ReturnEmailConfirmationView(EmailConfirmationViewModel emai private async Task GetMemberNotFoundViewModel() => new() { State = EmailConfirmationState.FailureNotYetConfirmed, - Message = stringLocalizer["Email confirmation failed. This user does not exist."], + Message = stringLocalizer["Email confirmation failed."], ActionButtonText = stringLocalizer["Register"], SignInOrRegisterPageUrl = await membershipService.GetRegisterUrl(preferredLanguageRetriever.Get(), true), - HomePageButtonText = stringLocalizer["Go to homepage"], + HomePageButtonText = stringLocalizer["Return to the home page"], HomePageUrl = httpRequestService.GetBaseUrlWithLanguage(true) }; @@ -125,7 +125,7 @@ public async Task Confirm(string memberEmail, string confirmToken) Message = stringLocalizer["Your email is already verified."], ActionButtonText = stringLocalizer["Sign in"], SignInOrRegisterPageUrl = await membershipService.GetSignInUrl(preferredLanguageRetriever.Get(), true), - HomePageButtonText = stringLocalizer["Go to homepage"], + HomePageButtonText = stringLocalizer["Return to the home page"], HomePageUrl = httpRequestService.GetBaseUrlWithLanguage(true) }); } @@ -148,7 +148,7 @@ public async Task Confirm(string memberEmail, string confirmToken) Message = stringLocalizer["Success! Email confirmed."], ActionButtonText = stringLocalizer["Sign in"], SignInOrRegisterPageUrl = await membershipService.GetSignInUrl(preferredLanguageRetriever.Get(), true), - HomePageButtonText = stringLocalizer["Go to homepage"], + HomePageButtonText = stringLocalizer["Return to the home page"], HomePageUrl = httpRequestService.GetBaseUrlWithLanguage(true) }); } @@ -164,7 +164,7 @@ public async Task Confirm(string memberEmail, string confirmToken) { State = EmailConfirmationState.FailureConfirmationFailed, Message = stringLocalizer["Email Confirmation failed"], - ActionButtonText = stringLocalizer["Send Again"], + ActionButtonText = stringLocalizer["Send again"], Username = userName }); } @@ -193,8 +193,8 @@ await emailService.SendEmail(new EmailMessage() Recipients = member.Email, Subject = $"{stringLocalizer["Confirm your email here"]}", Body = $""" -

{stringLocalizer["To confirm your email address, click "]}{stringLocalizer["here"]}.

-

{stringLocalizer["You can also copy and paste this URL into your browser."]}

+

{stringLocalizer["To confirm your email address, click"]} {stringLocalizer["here"]}.

+

{stringLocalizer["You can also copy-paste the following URL into your browser:"]}

{confirmationURL}

""" }); diff --git a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs index 74255624..b33028be 100644 --- a/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs +++ b/src/TrainingGuides.Web/Features/Membership/Services/MembershipService.cs @@ -160,8 +160,6 @@ private async Task GetPageUrl(string expectedPagePath, string language, languageName: language ); - // using the relative URL with Replace instead of the absolute URL to avoid having the "https" in cases when we need https - // (absolute URL always contains https) return absoluteURL ? signInUrl.RelativePath.Replace("~", httpRequestService.GetBaseUrl()) : signInUrl.RelativePath; diff --git a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs index 7735de95..f39e96da 100644 --- a/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs +++ b/src/TrainingGuides.Web/Features/Membership/Widgets/ResetPassword/ResetPasswordViewModel.cs @@ -50,7 +50,7 @@ public class ResetPasswordViewModel [DataType(DataType.Password)] [Required()] - [DisplayName("Confirm your Password")] + [DisplayName("Confirm your password")] [MaxLength(100)] [Compare(nameof(Password))] public string ConfirmPassword { get; set; } = string.Empty; diff --git a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs index 2ec617c0..72d471e7 100644 --- a/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs +++ b/src/TrainingGuides.Web/Features/Shared/Helpers/ApplicationConstants.cs @@ -6,10 +6,10 @@ internal static class ApplicationConstants public const string LANGUAGE_KEY = "language"; //Membership - public const string EXPECTED_SIGN_IN_PATH = "/Sign_in"; - public const string EXPECTED_REGISTER_PATH = "/Register"; + public const string EXPECTED_SIGN_IN_PATH = "/Membership/Sign_in"; + public const string EXPECTED_REGISTER_PATH = "/Membership/Register"; public const string ACCESS_DENIED_ACTION_PATH = "/Authentication/AccessDenied"; - public const string REQUEST_RESET_PASSWORD_ACTION_PATH = "/MembershipManagement/RequestResetPassword"; + public const string REQUEST_RESET_PASSWORD_ACTION_PATH = "/MemberManagement/RequestResetPassword"; public const string UPDATE_PROFILE_ACTION_PATH = "/MemberManagement/UpdateProfile"; public const string PASSWORD_RESET_ACTION_PATH = "/MembershipManagement/ResetPassword"; public const string REGISTER_ACTION_PATH = "/Registration/Register"; diff --git a/src/TrainingGuides.Web/Resources/SharedResources.es.resx b/src/TrainingGuides.Web/Resources/SharedResources.es.resx index 233428ac..2614d016 100644 --- a/src/TrainingGuides.Web/Resources/SharedResources.es.resx +++ b/src/TrainingGuides.Web/Resources/SharedResources.es.resx @@ -216,6 +216,36 @@ Confirme su contraseña + + Su intento de inicio de sesión no fue exitoso. Vuelve a intentarlo. + + + Perfil actualizado exitosamente. + + + Actualizar + + + Por favor, rellene todos los campos obligatorios. + + + ¡Éxito! Hemos enviado a usted un email. Confirme su membresía haciendo clic en el enlace contenido en el correo electrónico. + + + Guías de formación de Kentico + + + La confirmación del correo electrónico falló. + + + Enviar de nuevo + + + Para confirmar su dirección de correo electrónico, haga clic + + + Le hemos enviado un correo electrónico de confirmación que contiene un enlace de verificación de email. Confirme su membresía haciendo clic en el enlace incluido en el correo electrónico. + Enviar