From d9303f87c800ad519c5868413f2735c30d6e9bdc Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Fri, 10 Jul 2026 16:34:02 -0400 Subject: [PATCH] set last used cookie in smart login lookup --- messages/en-US.json | 2 +- src/components/SmartLoginOrgSelector.tsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/messages/en-US.json b/messages/en-US.json index ee3e16102..5833647e1 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1517,7 +1517,7 @@ "otpAuthDescription": "Enter the code from your authenticator app or one of your single-use backup codes.", "otpAuthSubmit": "Submit Code", "idpContinue": "Or continue with", - "idpLastUsed": "Last used", + "idpLastUsed": "Last Used", "otpAuthBack": "Back to Password", "navbar": "Navigation Menu", "navbarDescription": "Main navigation menu for the application", diff --git a/src/components/SmartLoginOrgSelector.tsx b/src/components/SmartLoginOrgSelector.tsx index 79a43782e..22a5bb01c 100644 --- a/src/components/SmartLoginOrgSelector.tsx +++ b/src/components/SmartLoginOrgSelector.tsx @@ -17,6 +17,8 @@ import { } from "next/navigation"; import { cleanRedirect } from "@app/lib/cleanRedirect"; import { Separator } from "@app/components/ui/separator"; +import { setClientCookie } from "@app/lib/setClientCookie"; +import { LAST_USED_IDP_COOKIE_NAME } from "@app/lib/consts"; type SmartLoginOrgSelectorProps = { identifier: string; @@ -141,6 +143,17 @@ export default function SmartLoginOrgSelector({ setPendingIdpId(idpId); setError(null); + setClientCookie( + LAST_USED_IDP_COOKIE_NAME, + JSON.stringify({ + orgId, + idpId + }), + { + sameSite: "Lax" + } + ); + let redirectToUrl: string | undefined; try { const safeRedirect = cleanRedirect(redirect || "/");