From 92bae87657c912850c47d37677a633c4ded97806 Mon Sep 17 00:00:00 2001 From: Rupato Braganza Date: Thu, 27 Feb 2025 13:47:56 +0800 Subject: [PATCH] fix: oidc issues --- src/pages/callback/callback-page.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/callback/callback-page.tsx b/src/pages/callback/callback-page.tsx index 232c2d5d..cc268dbf 100644 --- a/src/pages/callback/callback-page.tsx +++ b/src/pages/callback/callback-page.tsx @@ -54,8 +54,13 @@ const CallbackPage = () => { localStorage.setItem('active_loginid', tokens.acct1); } + const client_accounts = JSON.parse(localStorage.getItem('clientAccounts') || '{}'); const currency = sessionStorage.getItem('query_param_currency'); - window.location.assign(state && state?.account ? state?.account : `/?account=${currency || 'USD'}`); + + const is_valid_currency = currency && Object.prototype.hasOwnProperty.call(client_accounts, currency); + + const selected_currency = is_valid_currency ? currency : 'USD'; + window.location.assign(`/?account=${selected_currency}`); }} renderReturnButton={() => { return (