diff --git a/src/gui/src/UI/Dashboard/UIDashboard.js b/src/gui/src/UI/Dashboard/UIDashboard.js index 16e4b1572..5ef23e5f8 100644 --- a/src/gui/src/UI/Dashboard/UIDashboard.js +++ b/src/gui/src/UI/Dashboard/UIDashboard.js @@ -228,6 +228,18 @@ async function UIDashboard (options) { } } + // Saving a temporary account promotes this session's user in place: the + // save prompt goes, and the tabs that leave out cards for a temporary + // user (password, email) render again. + window.addEventListener('account-saved', () => { + $el_window.find('.bento-save-account-warning').remove(); + for ( const tab of tabs ) { + if ( tab.id !== 'account' && tab.id !== 'security' ) continue; + $el_window.find(`.dashboard-section-${tab.id}`).html(tab.html()); + tab.init?.($el_window); + } + }); + // Dispatch 'dashboard-ready' event for extensions window.dispatchEvent(new CustomEvent('dashboard-ready', { detail: { window: $el_window } })); diff --git a/src/gui/src/UI/UIWindowSaveAccount.js b/src/gui/src/UI/UIWindowSaveAccount.js index dfbc353dc..91ea56ad8 100644 --- a/src/gui/src/UI/UIWindowSaveAccount.js +++ b/src/gui/src/UI/UIWindowSaveAccount.js @@ -156,11 +156,11 @@ async function UIWindowSaveAccount (options) { 'Authorization': `Bearer ${window.auth_token}`, }, success: async function (data) { - window.dispatchEvent(new CustomEvent('account-saved', { detail: { data: data } })); - // /save_account promotes the current session's user in place // and does not rotate the token, so keep the one we have. await window.update_auth_data(data.token ?? window.auth_token, data.user); + // After the update, so listeners read the saved user. + window.dispatchEvent(new CustomEvent('account-saved', { detail: { data: data } })); //close this window if ( data.user.requires_email_confirmation && !data.user.email_confirmed ) {