Skip to content

Commit

Permalink
User is unable to exit from the flow when trying to access the verifi…
Browse files Browse the repository at this point in the history
…cation link for change email flow from another logged out device (deriv-com#16033)

* fix: fix redirectURL code fix

* chore: 2 more solution on how to restore code value and remove it from url

* chore: remove code from local storage

* chore: move the setSession code for request_email from client store to switch case

* fix: remove client-store changes

* fix: remove comments

* fix: comments

* chore: remove client-store changes in useSetLogin

* fix: normal flow modal pop up

* fix: add else case
  • Loading branch information
utkarsha-deriv authored Aug 8, 2024
1 parent 1cb150c commit 1cb4ca2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
15 changes: 14 additions & 1 deletion packages/core/src/App/Containers/Redirect/redirect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/Services/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1cb4ca2

Please sign in to comment.