mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-14 18:19:07 +00:00
Await update_auth_data to avoid races
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
This commit is contained in:
@@ -476,7 +476,7 @@ async function UIDashboard (options) {
|
||||
if ( l_user.username === window.user.username ) {
|
||||
return;
|
||||
}
|
||||
window.update_auth_data(l_user.auth_token, l_user);
|
||||
await window.update_auth_data(l_user.auth_token, l_user);
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2195,7 +2195,7 @@ $(document).on('click', '.user-options-menu-btn', async function (e) {
|
||||
return;
|
||||
}
|
||||
// update auth data
|
||||
window.update_auth_data(l_user.auth_token, l_user);
|
||||
await window.update_auth_data(l_user.auth_token, l_user);
|
||||
// refresh
|
||||
location.reload();
|
||||
},
|
||||
|
||||
@@ -395,7 +395,7 @@ async function UIWindowLogin (options) {
|
||||
|
||||
await p;
|
||||
|
||||
window.update_auth_data(data.token, data.user);
|
||||
await window.update_auth_data(data.token, data.user);
|
||||
|
||||
if ( options.reload_on_success ) {
|
||||
window.onbeforeunload = null;
|
||||
|
||||
@@ -158,7 +158,7 @@ async function UIWindowSaveAccount (options) {
|
||||
success: async function (data) {
|
||||
window.dispatchEvent(new CustomEvent('account-saved', { detail: { data: data } }));
|
||||
|
||||
window.update_auth_data(data.token, data.user);
|
||||
await window.update_auth_data(data.token, data.user);
|
||||
|
||||
//close this window
|
||||
if ( data.user.email_confirmation_required ) {
|
||||
|
||||
@@ -147,7 +147,7 @@ async function UIWindowSessionList (options) {
|
||||
$(el_window).find('.session-entry').on('click', function (e) {
|
||||
$(el_window).find('.loading').css({ display: 'flex' });
|
||||
|
||||
setTimeout(() => {
|
||||
setTimeout(async () => {
|
||||
let selected_uuid = $(this).attr('data-uuid');
|
||||
let selected_user;
|
||||
for ( let index = 0; index < window.logged_in_users.length; index++ ) {
|
||||
@@ -158,7 +158,7 @@ async function UIWindowSessionList (options) {
|
||||
}
|
||||
|
||||
// new logged in user
|
||||
window.update_auth_data(selected_user.auth_token, selected_user);
|
||||
await window.update_auth_data(selected_user.auth_token, selected_user);
|
||||
if ( options.reload_on_success ) {
|
||||
// disable native browser exit confirmation
|
||||
window.onbeforeunload = null;
|
||||
|
||||
@@ -332,7 +332,7 @@ function UIWindowSignup (options) {
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(requestData),
|
||||
success: async function (data) {
|
||||
window.update_auth_data(data.token, data.user);
|
||||
await window.update_auth_data(data.token, data.user);
|
||||
|
||||
//send out the login event
|
||||
if ( options.reload_on_success ) {
|
||||
|
||||
Reference in New Issue
Block a user