From 5588671686f79f5c0c7989d1fe3ef5e72e50487a Mon Sep 17 00:00:00 2001 From: Mark Ellevsen Date: Mon, 1 Sep 2025 08:31:14 +1000 Subject: [PATCH 1/2] feat: Set login link to first product when user has multiple products --- packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts b/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts index e791e04403..8c7631c85e 100644 --- a/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts +++ b/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts @@ -44,7 +44,7 @@ const getConfirmRegistrationUrl = async (emailAddress: string) => { return confirmRegistrationUrl } const user: UserModel = await res.json() - if (user.products.length === 1) { + if (user.products.length > 0) { const productId = user.products[0].id if (productId === 'agentbox') return agentboxUrl if (productId === 'agentpoint') return agentpointUrl From cc0c17dae1720e99c2443fb8c864577e29559595 Mon Sep 17 00:00:00 2001 From: Mark Ellevsen Date: Thu, 16 Oct 2025 08:28:20 +1000 Subject: [PATCH 2/2] feat: Make product key comparison case-insensitive --- .gitignore | 3 ++- .../src/mailer/custom-mailer.ts | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index d49a1b56fe..ce404522ff 100644 --- a/.gitignore +++ b/.gitignore @@ -99,4 +99,5 @@ cdk.context.json packages/cognito-custom-mail-lambda/**/*.html -.tmp \ No newline at end of file +.tmp +.vs diff --git a/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts b/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts index 8c7631c85e..8cbf1226ce 100644 --- a/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts +++ b/packages/cognito-custom-mail-lambda/src/mailer/custom-mailer.ts @@ -44,15 +44,15 @@ const getConfirmRegistrationUrl = async (emailAddress: string) => { return confirmRegistrationUrl } const user: UserModel = await res.json() + if (user.products.length > 0) { - const productId = user.products[0].id + const productId = (user.products[0].id || '').toLowerCase() if (productId === 'agentbox') return agentboxUrl if (productId === 'agentpoint') return agentpointUrl - if (productId === 'consoleCloud') return consoleUrl - if (productId === 'ireWeb') return ireUrl - if (productId === 'mmiWeb') return mmiUrl + if (productId === 'consolecloud') return consoleUrl + if (productId === 'ireweb') return ireUrl + if (productId === 'mmiweb') return mmiUrl } - return confirmRegistrationUrl }