From 42ef8527df39d6d41e255e24deeb28b458a30519 Mon Sep 17 00:00:00 2001 From: VS Date: Thu, 15 Aug 2024 14:57:22 +0100 Subject: [PATCH 1/6] added checkbox to record Indefinite RTW, when checked, ValidTo date is disabled and populated as 31/12/9999 --- .../Enrolments/Components/RightToWork.razor | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor index 8a79f5a2..36162def 100644 --- a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor +++ b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor @@ -41,7 +41,8 @@ Yes, Right to Work is required No, Right to Work is not required - + + @if (_isRequired) { - + @bind-Date="Model.ValidTo" Disabled="_disabled" Required />
@@ -83,14 +84,17 @@ private bool _isRequired = true; private bool _uploading = false; - + private bool _disabled = false; + private MudDatePicker? _dpValidTo; + MudCheckBox IndefiniteRtw { get; set; } = default!; + [EditorRequired] [Parameter] public AddRightToWork.Command? Model { get; set; } [Parameter] public RightToWorkDto[]? RightToWorkDtos { get; set; } - + private MudForm? Form { get; set; } public async Task Validate() @@ -99,7 +103,7 @@ { return true; } - + await Form!.Validate(); if (Form.IsValid) @@ -132,11 +136,24 @@ await using var stream = file.OpenReadStream(maxFileSize); using var memoryStream = new MemoryStream(); await stream.CopyToAsync(memoryStream); - + Model!.UploadRequest = new UploadRequest(file.Name, UploadType.Document, memoryStream.ToArray()); _uploading = false; } } } + private void IndefiniteRtwOnValueChanged() + { + if (IndefiniteRtw.Value) + { + _disabled = true; + Model!.ValidTo = new DateTime(9999, 12, 31); + } + else + { + _disabled = false; + Model!.ValidTo = null; + } + } } From e3a75b6addf16dedb2f7110285777c44cdec09a3 Mon Sep 17 00:00:00 2001 From: VS Date: Thu, 15 Aug 2024 14:57:22 +0100 Subject: [PATCH 2/6] added checkbox to record Indefinite RTW, when checked, ValidTo date is disabled and populated as 31/12/9999 --- .../Enrolments/Components/RightToWork.razor | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor index 8a79f5a2..36162def 100644 --- a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor +++ b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor @@ -41,7 +41,8 @@ Yes, Right to Work is required No, Right to Work is not required - + + @if (_isRequired) { - + @bind-Date="Model.ValidTo" Disabled="_disabled" Required />
@@ -83,14 +84,17 @@ private bool _isRequired = true; private bool _uploading = false; - + private bool _disabled = false; + private MudDatePicker? _dpValidTo; + MudCheckBox IndefiniteRtw { get; set; } = default!; + [EditorRequired] [Parameter] public AddRightToWork.Command? Model { get; set; } [Parameter] public RightToWorkDto[]? RightToWorkDtos { get; set; } - + private MudForm? Form { get; set; } public async Task Validate() @@ -99,7 +103,7 @@ { return true; } - + await Form!.Validate(); if (Form.IsValid) @@ -132,11 +136,24 @@ await using var stream = file.OpenReadStream(maxFileSize); using var memoryStream = new MemoryStream(); await stream.CopyToAsync(memoryStream); - + Model!.UploadRequest = new UploadRequest(file.Name, UploadType.Document, memoryStream.ToArray()); _uploading = false; } } } + private void IndefiniteRtwOnValueChanged() + { + if (IndefiniteRtw.Value) + { + _disabled = true; + Model!.ValidTo = new DateTime(9999, 12, 31); + } + else + { + _disabled = false; + Model!.ValidTo = null; + } + } } From 35b2e18b0dd772ddee40f92501a1dd0b08170222 Mon Sep 17 00:00:00 2001 From: Carl Sixsmith Date: Tue, 20 Aug 2024 08:05:13 +0100 Subject: [PATCH 3/6] Addresses issues with user registration - The phone number now saves on create - Two factor auth is enabled by default - Set all users to 'false' for export and import --- .../Features/Identity/DTOs/ApplicationUserDto.cs | 1 + src/Server.UI/Pages/Identity/Users/Users.razor | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs b/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs index 44d86597..b8d009cd 100644 --- a/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs +++ b/src/Application/Features/Identity/DTOs/ApplicationUserDto.cs @@ -78,6 +78,7 @@ public Mapping() .ForMember(x => x.SuperiorName, s => s.MapFrom(y => y.Superior!.UserName)) .ForMember(x => x.TenantName, s => s.MapFrom(y => y.Tenant!.Name)) .ForMember(x => x.AssignedRoles, s => s.MapFrom(y => y.UserRoles.Select(r => r.Role.Name))) + .ForMember(x => x.PhoneNumber, s => s.MapFrom(x => x.PhoneNumber)) .ReverseMap() .ForMember(x => x.UserName, s => s.MapFrom(y => y.Email)) .ForMember(x => x.Notes, s => s.Ignore()) diff --git a/src/Server.UI/Pages/Identity/Users/Users.razor b/src/Server.UI/Pages/Identity/Users/Users.razor index 2b4a8c14..edc0d51a 100644 --- a/src/Server.UI/Pages/Identity/Users/Users.razor +++ b/src/Server.UI/Pages/Identity/Users/Users.razor @@ -389,8 +389,8 @@ policies ??= new() { { SecurityPolicies.SystemFunctionsWrite, (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.SystemFunctionsWrite)).Succeeded }, - { SecurityPolicies.Import, (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Import)).Succeeded }, - { SecurityPolicies.Export, (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Export)).Succeeded } + { SecurityPolicies.Import, false /*(await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Import)).Succeeded */ }, + { SecurityPolicies.Export, false /* (await AuthService.AuthorizeAsync(state.User, SecurityPolicies.Export)).Succeeded */ } }; _canCreate = policies.GetValueOrDefault(SecurityPolicies.SystemFunctionsWrite); @@ -533,6 +533,8 @@ var applicationUser = Mapper.Map(model); applicationUser.EmailConfirmed = true; applicationUser.IsActive = true; + applicationUser.TwoFactorEnabled = true; + applicationUser.PhoneNumberConfirmed = string.IsNullOrWhiteSpace(applicationUser.PhoneNumber) == false; var identityResult = await UserManager.CreateAsync(applicationUser); if (!identityResult.Succeeded) @@ -556,6 +558,8 @@ Mapper.Map(model, user); + user.PhoneNumberConfirmed = string.IsNullOrWhiteSpace(user.PhoneNumber) == false; + var identityResult = await UserManager.UpdateAsync(user); if (identityResult.Succeeded) { From 628c9839c2c88b1b199cf3ff391aeb4dbd166c19 Mon Sep 17 00:00:00 2001 From: Carl Sixsmith Date: Tue, 20 Aug 2024 08:21:15 +0100 Subject: [PATCH 4/6] Ask browsers not to allow autocomplete on login --- src/Server.UI/Pages/Identity/Authentication/Login.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Server.UI/Pages/Identity/Authentication/Login.razor b/src/Server.UI/Pages/Identity/Authentication/Login.razor index 4b32e9c7..44feb233 100644 --- a/src/Server.UI/Pages/Identity/Authentication/Login.razor +++ b/src/Server.UI/Pages/Identity/Authentication/Login.razor @@ -77,7 +77,7 @@
- +
From c74a783901f04fc6cafcd7df195cde6c6cb94e25 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 19 Aug 2024 13:26:54 +0100 Subject: [PATCH 5/6] Validation fixes for QA screens --- .../Features/QualityAssurance/Commands/SubmitPqaResponse.cs | 6 ++---- .../Features/QualityAssurance/Commands/SubmitQa1Response.cs | 4 +--- .../Features/QualityAssurance/Commands/SubmitQa2Response.cs | 4 +--- src/Server.UI/Pages/QA/Enrolments/PQA.razor | 4 ++-- src/Server.UI/Pages/QA/Enrolments/QA1.razor | 4 ++-- src/Server.UI/Pages/QA/Enrolments/QA2.razor | 4 ++-- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs b/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs index fe3d3bc4..14f606a8 100644 --- a/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs +++ b/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs @@ -44,16 +44,14 @@ public A_IsValidRequest() .NotNull() .WithMessage("You must accept or return the request"); - When(x => x.Accept == false, () => { + When(x => x.Accept is false, () => + { RuleFor(x => x.Message) - .NotNull() - .WithMessage("A message is required when returning") .NotEmpty() .WithMessage("A message is required when returning") .Matches(ValidationConstants.Notes) .WithMessage(string.Format(ValidationConstants.NotesMessage, "Message")); }); - } } diff --git a/src/Application/Features/QualityAssurance/Commands/SubmitQa1Response.cs b/src/Application/Features/QualityAssurance/Commands/SubmitQa1Response.cs index 93f1a31b..00e68891 100644 --- a/src/Application/Features/QualityAssurance/Commands/SubmitQa1Response.cs +++ b/src/Application/Features/QualityAssurance/Commands/SubmitQa1Response.cs @@ -44,10 +44,8 @@ public A_IsValidRequest() .NotNull() .WithMessage("You must accept or return the request"); - When(x => x.Accept == false, () => { + When(x => x.Accept is false, () => { RuleFor(x => x.Message) - .NotNull() - .WithMessage("A message is required when returning") .NotEmpty() .WithMessage("A message is required when returning") .Matches(ValidationConstants.Notes) diff --git a/src/Application/Features/QualityAssurance/Commands/SubmitQa2Response.cs b/src/Application/Features/QualityAssurance/Commands/SubmitQa2Response.cs index fdc408e8..1994f087 100644 --- a/src/Application/Features/QualityAssurance/Commands/SubmitQa2Response.cs +++ b/src/Application/Features/QualityAssurance/Commands/SubmitQa2Response.cs @@ -44,10 +44,8 @@ public A_IsValidRequest() .NotNull() .WithMessage("You must accept or return the request"); - When(x => x.Accept == false, () => { + When(x => x.Accept is false, () => { RuleFor(x => x.Message) - .NotNull() - .WithMessage("A message is required when returning") .NotEmpty() .WithMessage("A message is required when returning") .Matches(ValidationConstants.Notes) diff --git a/src/Server.UI/Pages/QA/Enrolments/PQA.razor b/src/Server.UI/Pages/QA/Enrolments/PQA.razor index 8092cdf9..8eab774b 100644 --- a/src/Server.UI/Pages/QA/Enrolments/PQA.razor +++ b/src/Server.UI/Pages/QA/Enrolments/PQA.razor @@ -87,7 +87,7 @@ { - + Accept @@ -97,7 +97,7 @@ - + Submit diff --git a/src/Server.UI/Pages/QA/Enrolments/QA1.razor b/src/Server.UI/Pages/QA/Enrolments/QA1.razor index 19f3effe..42314285 100644 --- a/src/Server.UI/Pages/QA/Enrolments/QA1.razor +++ b/src/Server.UI/Pages/QA/Enrolments/QA1.razor @@ -87,7 +87,7 @@ { - + Accept @@ -97,7 +97,7 @@ - + Submit diff --git a/src/Server.UI/Pages/QA/Enrolments/QA2.razor b/src/Server.UI/Pages/QA/Enrolments/QA2.razor index f885f502..0b2b43e7 100644 --- a/src/Server.UI/Pages/QA/Enrolments/QA2.razor +++ b/src/Server.UI/Pages/QA/Enrolments/QA2.razor @@ -96,8 +96,8 @@ - - + + Submit From 2ece3401812f8909046246773d9e4f0133720e2a Mon Sep 17 00:00:00 2001 From: VS Date: Wed, 21 Aug 2024 09:37:42 +0100 Subject: [PATCH 6/6] When Indefinite Right To Work is checked, hiding ValidTo date --- .../Enrolments/Components/RightToWork.razor | 59 +++++++++++-------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor index 36162def..e7ac649a 100644 --- a/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor +++ b/src/Server.UI/Pages/Enrolments/Components/RightToWork.razor @@ -10,27 +10,27 @@ if (RightToWorkDtos is not null && RightToWorkDtos.Length > 0) { - Right To Work supporting documentation already updated + Right To Work supporting documentation already updated - + @foreach (var c in RightToWorkDtos) { - @c.FileName + @c.FileName - } + } - + Add New } else { - + For anyone recorded on PNomis / NDelius as non-British / non-Irish, documentation is required to support their Right to Work. More information on this requirement can be found in the CFO Enrolment Guidance. @@ -38,22 +38,24 @@ To your knowledge, is any Right to Work (RTW) documentation required for the enrolment of this person? - Yes, Right to Work is required - No, Right to Work is not required + Yes, Right to Work is required + No, Right to Work is not required - @if (_isRequired) { + - - + @bind-Date="Model.ValidFrom" Required /> + @if (_isIndefiniteRtwChecked == false) + { + + }
@@ -63,7 +65,7 @@ StartIcon="@Icons.Material.Filled.Upload"> @if (_uploading) { - + @ConstantString.Uploading } else @@ -84,13 +86,11 @@ private bool _isRequired = true; private bool _uploading = false; - private bool _disabled = false; - private MudDatePicker? _dpValidTo; - MudCheckBox IndefiniteRtw { get; set; } = default!; + private bool _isIndefiniteRtwChecked { get; set; } = false; [EditorRequired] [Parameter] - public AddRightToWork.Command? Model { get; set; } + public AddRightToWork.Command? Model { get; set; } [Parameter] public RightToWorkDto[]? RightToWorkDtos { get; set; } @@ -143,16 +143,27 @@ } } - private void IndefiniteRtwOnValueChanged() + private void RightToWorkRequiredOnClick() + { + _isRequired = true; + + IndefiniteRtwOnValueChanged(_isIndefiniteRtwChecked); + } + private void NoRightToWorkRequiredOnClick() + { + _isRequired = false; + + IndefiniteRtwOnValueChanged(_isIndefiniteRtwChecked); + } + private void IndefiniteRtwOnValueChanged(bool isIndefiniteRtwChecked) { - if (IndefiniteRtw.Value) + _isIndefiniteRtwChecked = isIndefiniteRtwChecked; + if (_isIndefiniteRtwChecked) { - _disabled = true; Model!.ValidTo = new DateTime(9999, 12, 31); } else { - _disabled = false; Model!.ValidTo = null; } }