From b84f2d05d06b41908b1c12081446007254365e7b Mon Sep 17 00:00:00 2001 From: JacobSilasBentley Date: Fri, 20 Nov 2026 16:16:14 +0000 Subject: [PATCH 1/3] UKPS-824 - Removed SetupLink env var in favour of using HostUri env var --- .../Application/Authentication/UserOnboardingOptions.cs | 3 --- .../WebApi/InternalServices/Hosting/SetupLinkCreator.cs | 7 +++---- backend/src/appsettings.Example.json | 1 - backend/src/appsettings.json | 1 - .../InternalServices/Hosting/SetupLinkCreatorTests.cs | 6 ++---- infrastructure/environments/dev/main.tf | 1 - infrastructure/environments/test/main.tf | 1 - 7 files changed, 5 insertions(+), 15 deletions(-) diff --git a/backend/src/Application/Authentication/UserOnboardingOptions.cs b/backend/src/Application/Authentication/UserOnboardingOptions.cs index 0c3816037..eda0c8933 100644 --- a/backend/src/Application/Authentication/UserOnboardingOptions.cs +++ b/backend/src/Application/Authentication/UserOnboardingOptions.cs @@ -12,9 +12,6 @@ internal sealed record UserOnboardingOptions [Range(60, int.MaxValue)] public int SetupTokenExpiryTimeSeconds { get; set; } = 30 * 60; - [Required] - public required Uri SetupLink { get; init; } - [Required] [Range(1, int.MaxValue)] public int MaxSmsSetupAttempts { get; set; } = 5; diff --git a/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs b/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs index 130314a25..e25940a3f 100644 --- a/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs +++ b/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs @@ -1,20 +1,19 @@ using Microsoft.Extensions.Options; -using UKPS.Api.Application.Authentication; using UKPS.Api.Application.InternalServices.Hosting; namespace UKPS.Api.WebApi.InternalServices.Hosting; internal class SetupLinkCreator : ISetupLinkCreator { - private readonly UserOnboardingOptions _configuration; + private readonly HostingOptions _configuration; - public SetupLinkCreator(IOptions configuration) + public SetupLinkCreator(IOptions configuration) { _configuration = configuration.Value; } public Uri GetSetupLink(Guid setupToken) { - return new Uri(_configuration.SetupLink, $"/auth/sign-up/initiate?setupToken={setupToken}"); + return new Uri(_configuration.HostUri, $"/auth/sign-up/initiate?setupToken={setupToken}"); } } diff --git a/backend/src/appsettings.Example.json b/backend/src/appsettings.Example.json index 91c477c27..7199a5565 100644 --- a/backend/src/appsettings.Example.json +++ b/backend/src/appsettings.Example.json @@ -47,7 +47,6 @@ "QueueWaitTimeInSeconds": 20 }, "UserOnboarding": { - "SetupLink": "https://placeholder", "SetupTokenExpiryTimeSeconds": 1800, "MaxSmsSetupAttempts": 5, "SmsSetupCooldownSeconds": 30 diff --git a/backend/src/appsettings.json b/backend/src/appsettings.json index 166a2edce..a5c2763cb 100644 --- a/backend/src/appsettings.json +++ b/backend/src/appsettings.json @@ -47,7 +47,6 @@ "QueueWaitTimeInSeconds": 20 }, "UserOnboarding": { - "SetupLink": "https://placeholder", "SetupTokenExpiryTimeSeconds": 1800, "MaxSmsSetupAttempts": 5, "SmsSetupCooldownSeconds": 30 diff --git a/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs b/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs index 340de779c..1a5675aac 100644 --- a/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs +++ b/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Options; using Shouldly; -using UKPS.Api.Application.Authentication; +using UKPS.Api.WebApi; using UKPS.Api.WebApi.InternalServices.Hosting; namespace UKPS.Api.Tests.WebApi.InternalServices.Hosting; @@ -12,9 +12,7 @@ public void GetSetupLink_ShouldReturnFrontendInitiateAuthLinkWithSetupToken() { var setupToken = Guid.Parse("48b5becd-f98c-4897-98aa-be37eecb6a68"); var creator = new SetupLinkCreator( - Options.Create( - new UserOnboardingOptions { SetupLink = new Uri("https://frontend.example") } - ) + Options.Create(new HostingOptions { HostUri = new Uri("https://frontend.example") }) ); Uri setupLink = creator.GetSetupLink(setupToken); diff --git a/infrastructure/environments/dev/main.tf b/infrastructure/environments/dev/main.tf index 8c73c7c7b..244b871ce 100644 --- a/infrastructure/environments/dev/main.tf +++ b/infrastructure/environments/dev/main.tf @@ -251,7 +251,6 @@ module "ecs_backend" { Email__MaxResendSignUpLinkAttempts = "3" Email__QueueUrl = module.sqs_email_backend.queue_url Seeding__ReseedOnStartup = "false" - UserOnboarding__SetupLink = "https://${module.alb.frontend_host_name}" # TODO 824: Remove this in favour of using the HostUri variable Hosting__HostUri = "https://${module.alb.frontend_host_name}" } container_secrets = { diff --git a/infrastructure/environments/test/main.tf b/infrastructure/environments/test/main.tf index a7581817a..2cce2f86a 100644 --- a/infrastructure/environments/test/main.tf +++ b/infrastructure/environments/test/main.tf @@ -251,7 +251,6 @@ module "ecs_backend" { Email__MaxResendSignUpLinkAttempts = "3" Email__QueueUrl = module.sqs_email_backend.queue_url Seeding__ReseedOnStartup = "false" - UserOnboarding__SetupLink = "https://${module.alb.frontend_host_name}" Hosting__HostUri = "https://${module.alb.frontend_host_name}" } container_secrets = { From 873bd17ee2050490f66601695bef2fb54f2210f3 Mon Sep 17 00:00:00 2001 From: JacobSilasBentley Date: Fri, 20 Nov 2026 16:49:50 +0000 Subject: [PATCH 2/3] UKPS-725 - Added fix to avoid error message briefly flashing on success. --- .../auth/sign-up/set-mfa/sms/check-your-phone/page.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/(public)/auth/sign-up/set-mfa/sms/check-your-phone/page.tsx b/frontend/src/app/(public)/auth/sign-up/set-mfa/sms/check-your-phone/page.tsx index 4754d8bbb..818b7e662 100644 --- a/frontend/src/app/(public)/auth/sign-up/set-mfa/sms/check-your-phone/page.tsx +++ b/frontend/src/app/(public)/auth/sign-up/set-mfa/sms/check-your-phone/page.tsx @@ -37,6 +37,7 @@ export default function CheckYourPhone() { const router = useRouter() const { clearPassword } = useSignUpPassword() const [submitError, setSubmitError] = useState(null) + const [success, setSuccess] = useState(false) let authenticationSession = '' let setupToken = '' @@ -72,6 +73,7 @@ export default function CheckYourPhone() { }) if (!result.error) { + setSuccess(true) try { sessionStorage.removeItem('signUpSmsSetup') } catch {} @@ -101,7 +103,7 @@ export default function CheckYourPhone() { }, }) - if (!hasSetup) { + if (!success && !hasSetup) { return ( <> From 715567e6be9622cdeb9db5569204a753b36695f9 Mon Sep 17 00:00:00 2001 From: JacobSilasBentley Date: Fri, 20 Nov 2026 16:52:12 +0000 Subject: [PATCH 3/3] Revert "UKPS-824 - Removed SetupLink env var in favour of using HostUri env var" This reverts commit b84f2d05d06b41908b1c12081446007254365e7b. --- .../Application/Authentication/UserOnboardingOptions.cs | 3 +++ .../WebApi/InternalServices/Hosting/SetupLinkCreator.cs | 7 ++++--- backend/src/appsettings.Example.json | 1 + backend/src/appsettings.json | 1 + .../InternalServices/Hosting/SetupLinkCreatorTests.cs | 6 ++++-- infrastructure/environments/dev/main.tf | 1 + infrastructure/environments/test/main.tf | 1 + 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/src/Application/Authentication/UserOnboardingOptions.cs b/backend/src/Application/Authentication/UserOnboardingOptions.cs index eda0c8933..0c3816037 100644 --- a/backend/src/Application/Authentication/UserOnboardingOptions.cs +++ b/backend/src/Application/Authentication/UserOnboardingOptions.cs @@ -12,6 +12,9 @@ internal sealed record UserOnboardingOptions [Range(60, int.MaxValue)] public int SetupTokenExpiryTimeSeconds { get; set; } = 30 * 60; + [Required] + public required Uri SetupLink { get; init; } + [Required] [Range(1, int.MaxValue)] public int MaxSmsSetupAttempts { get; set; } = 5; diff --git a/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs b/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs index e25940a3f..130314a25 100644 --- a/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs +++ b/backend/src/WebApi/InternalServices/Hosting/SetupLinkCreator.cs @@ -1,19 +1,20 @@ using Microsoft.Extensions.Options; +using UKPS.Api.Application.Authentication; using UKPS.Api.Application.InternalServices.Hosting; namespace UKPS.Api.WebApi.InternalServices.Hosting; internal class SetupLinkCreator : ISetupLinkCreator { - private readonly HostingOptions _configuration; + private readonly UserOnboardingOptions _configuration; - public SetupLinkCreator(IOptions configuration) + public SetupLinkCreator(IOptions configuration) { _configuration = configuration.Value; } public Uri GetSetupLink(Guid setupToken) { - return new Uri(_configuration.HostUri, $"/auth/sign-up/initiate?setupToken={setupToken}"); + return new Uri(_configuration.SetupLink, $"/auth/sign-up/initiate?setupToken={setupToken}"); } } diff --git a/backend/src/appsettings.Example.json b/backend/src/appsettings.Example.json index 7199a5565..91c477c27 100644 --- a/backend/src/appsettings.Example.json +++ b/backend/src/appsettings.Example.json @@ -47,6 +47,7 @@ "QueueWaitTimeInSeconds": 20 }, "UserOnboarding": { + "SetupLink": "https://placeholder", "SetupTokenExpiryTimeSeconds": 1800, "MaxSmsSetupAttempts": 5, "SmsSetupCooldownSeconds": 30 diff --git a/backend/src/appsettings.json b/backend/src/appsettings.json index a5c2763cb..166a2edce 100644 --- a/backend/src/appsettings.json +++ b/backend/src/appsettings.json @@ -47,6 +47,7 @@ "QueueWaitTimeInSeconds": 20 }, "UserOnboarding": { + "SetupLink": "https://placeholder", "SetupTokenExpiryTimeSeconds": 1800, "MaxSmsSetupAttempts": 5, "SmsSetupCooldownSeconds": 30 diff --git a/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs b/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs index 1a5675aac..340de779c 100644 --- a/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs +++ b/backend/tests/WebApi/InternalServices/Hosting/SetupLinkCreatorTests.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Options; using Shouldly; -using UKPS.Api.WebApi; +using UKPS.Api.Application.Authentication; using UKPS.Api.WebApi.InternalServices.Hosting; namespace UKPS.Api.Tests.WebApi.InternalServices.Hosting; @@ -12,7 +12,9 @@ public void GetSetupLink_ShouldReturnFrontendInitiateAuthLinkWithSetupToken() { var setupToken = Guid.Parse("48b5becd-f98c-4897-98aa-be37eecb6a68"); var creator = new SetupLinkCreator( - Options.Create(new HostingOptions { HostUri = new Uri("https://frontend.example") }) + Options.Create( + new UserOnboardingOptions { SetupLink = new Uri("https://frontend.example") } + ) ); Uri setupLink = creator.GetSetupLink(setupToken); diff --git a/infrastructure/environments/dev/main.tf b/infrastructure/environments/dev/main.tf index 244b871ce..8c73c7c7b 100644 --- a/infrastructure/environments/dev/main.tf +++ b/infrastructure/environments/dev/main.tf @@ -251,6 +251,7 @@ module "ecs_backend" { Email__MaxResendSignUpLinkAttempts = "3" Email__QueueUrl = module.sqs_email_backend.queue_url Seeding__ReseedOnStartup = "false" + UserOnboarding__SetupLink = "https://${module.alb.frontend_host_name}" # TODO 824: Remove this in favour of using the HostUri variable Hosting__HostUri = "https://${module.alb.frontend_host_name}" } container_secrets = { diff --git a/infrastructure/environments/test/main.tf b/infrastructure/environments/test/main.tf index 2cce2f86a..a7581817a 100644 --- a/infrastructure/environments/test/main.tf +++ b/infrastructure/environments/test/main.tf @@ -251,6 +251,7 @@ module "ecs_backend" { Email__MaxResendSignUpLinkAttempts = "3" Email__QueueUrl = module.sqs_email_backend.queue_url Seeding__ReseedOnStartup = "false" + UserOnboarding__SetupLink = "https://${module.alb.frontend_host_name}" Hosting__HostUri = "https://${module.alb.frontend_host_name}" } container_secrets = {