diff --git a/packages/core/src/App/Containers/Redirect/redirect.jsx b/packages/core/src/App/Containers/Redirect/redirect.jsx index 9223ec2b2e97..aa9f126a439e 100644 --- a/packages/core/src/App/Containers/Redirect/redirect.jsx +++ b/packages/core/src/App/Containers/Redirect/redirect.jsx @@ -64,7 +64,20 @@ const Redirect = observer(() => { break; } case 'request_email': { - toggleResetEmailModal(true); + if (!is_logging_in && !is_logged_in) { + if (verification_code[action_param]) { + sessionStorage.setItem('request_email_code', verification_code[action_param]); + } + redirectToLogin(is_logged_in, getLanguage(), true); + redirected_to_route = true; + } else { + if (!verification_code[action_param]) { + const request_email_code = sessionStorage.getItem('request_email_code'); + setVerificationCode(request_email_code, action_param); + sessionStorage.removeItem('request_email_code'); + } + toggleResetEmailModal(true); + } break; } case 'social_email_change': { diff --git a/packages/core/src/Services/logout.js b/packages/core/src/Services/logout.js index 608f470fd075..7c1ccf0b918a 100644 --- a/packages/core/src/Services/logout.js +++ b/packages/core/src/Services/logout.js @@ -14,6 +14,9 @@ const doLogout = response => { localStorage.removeItem('closed_toast_notifications'); localStorage.removeItem('is_wallet_migration_modal_closed'); localStorage.removeItem('active_wallet_loginid'); + localStorage.removeItem('verification_code.system_email_change'); + localStorage.removeItem('verification_code.request_email'); + localStorage.removeItem('new_email.system_email_change'); SocketCache.clear(); sessionStorage.clear(); endChat(); diff --git a/packages/core/src/Stores/client-store.js b/packages/core/src/Stores/client-store.js index da2aa5b7d47f..fb61c3210b9f 100644 --- a/packages/core/src/Stores/client-store.js +++ b/packages/core/src/Stores/client-store.js @@ -1517,7 +1517,7 @@ export default class ClientStore extends BaseStore { this.user_id = LocalStore.get('active_user_id'); this.setAccounts(LocalStore.getObject(storage_key)); this.setSwitched(''); - if (action_param === 'request_email') { + if (action_param === 'request_email' && this.is_logged_in) { const request_email_code = code_param ?? LocalStore.get(`verification_code.${action_param}`) ?? ''; if (request_email_code) { this.setVerificationCode(request_email_code, action_param);