From cef63459372281ac2a91888746a84b3159a8c6b4 Mon Sep 17 00:00:00 2001 From: AnhMTV Date: Wed, 20 Nov 2024 18:09:46 +0700 Subject: [PATCH] [Issue-149] Auto logout if login with wrong email --- .../src/contexts/AuthenticationMythProvider.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/extension-koni-ui/src/contexts/AuthenticationMythProvider.tsx b/packages/extension-koni-ui/src/contexts/AuthenticationMythProvider.tsx index 391d9dd686..e6c75e9230 100644 --- a/packages/extension-koni-ui/src/contexts/AuthenticationMythProvider.tsx +++ b/packages/extension-koni-ui/src/contexts/AuthenticationMythProvider.tsx @@ -92,7 +92,7 @@ export const AuthenticationMythProvider = ({ children }: AuthenticationMythProvi }); if (rs.error) { - Telegram.WebApp.showAlert(rs.error); + console.error(rs.error); } else if (rs.success) { setIsLinked(rs.success); setLinkData(rs.data); @@ -148,7 +148,11 @@ export const AuthenticationMythProvider = ({ children }: AuthenticationMythProvi setLinkData(rs.data); // Login with different email } else { - telegramConnector.showAlert(`Please login again with email "${rs.data?.link_email || ''}"`); + telegramConnector.showPopup({ + message: `Wrong email. Link Mythical account with email ${rs.data?.link_email || ''} and try again` + }, () => { + onLogoutMythAccount(); + }); } } else { console.log('tokenData', tokenData); @@ -156,7 +160,7 @@ export const AuthenticationMythProvider = ({ children }: AuthenticationMythProvi } }).catch(console.error); } - }, [authContext.token, currentAccount?.address, onSubmitMythAccount, tokenData]); + }, [authContext.token, currentAccount?.address, onLogoutMythAccount, onSubmitMythAccount, tokenData]); const authenticationValue: AuthenticationMythContextProps = { account,