Skip to content

Commit

Permalink
[Issue-149] Auto logout if login with wrong email
Browse files Browse the repository at this point in the history
  • Loading branch information
saltict committed Nov 20, 2024
1 parent c266a47 commit cef6345
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -148,15 +148,19 @@ 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);
onSubmitMythAccount(currentAccount?.address || '0x0').catch(console.error);
}
}).catch(console.error);
}
}, [authContext.token, currentAccount?.address, onSubmitMythAccount, tokenData]);
}, [authContext.token, currentAccount?.address, onLogoutMythAccount, onSubmitMythAccount, tokenData]);

const authenticationValue: AuthenticationMythContextProps = {
account,
Expand Down

0 comments on commit cef6345

Please sign in to comment.