fix: reset attemptingAutoLogin flag after auto-login attempt

This commit is contained in:
pa
2026-02-25 23:07:24 +09:00
committed by Natsumi
parent ea9d75f8ab
commit 8d80ef43c6
2 changed files with 27 additions and 14 deletions

View File

@@ -2229,6 +2229,18 @@
}, },
"message": { "message": {
"auto_login_delay_countdown": "Auto-login in {seconds}s...", "auto_login_delay_countdown": "Auto-login in {seconds}s...",
"auth": {
"login_greeting": "Hello there, {name}!",
"logout_greeting": "See you again, {name}!",
"email_2fa_resent": "Email 2FA resent.",
"email_2fa_no_credentials": "Cannot send 2FA email without saved credentials. Please login again.",
"incorrect_primary_password": "Incorrect primary password",
"saved_credentials_invalid": "Saved credentials are no longer valid.",
"account_removed": "Account removed.",
"auto_login_success": "Automatically logged in.",
"auto_login_failed": "Failed to login automatically.",
"offline": "You're offline."
},
"vrcx_updater": { "vrcx_updater": {
"failed": "Failed to check for update, {message}", "failed": "Failed to check for update, {message}",
"failed_install": "Failed to install update", "failed_install": "Failed to install update",

View File

@@ -78,9 +78,9 @@ export const useAuthStore = defineStore('Auth', () => {
updateStoredUser(currentUser); updateStoredUser(currentUser);
new Noty({ new Noty({
type: 'success', type: 'success',
text: `Hello there, <strong>${escapeTag( text: t('message.auth.login_greeting', {
currentUser.displayName name: `<strong>${escapeTag(currentUser.displayName)}</strong>`
)}</strong>!` })
}).show(); }).show();
} }
}, },
@@ -155,9 +155,9 @@ export const useAuthStore = defineStore('Auth', () => {
if (watchState.isLoggedIn) { if (watchState.isLoggedIn) {
new Noty({ new Noty({
type: 'success', type: 'success',
text: `See you again, <strong>${escapeTag( text: t('message.auth.logout_greeting', {
userStore.currentUser.displayName name: `<strong>${escapeTag(userStore.currentUser.displayName)}</strong>`
)}</strong>!` })
}).show(); }).show();
} }
userStore.userDialog.visible = false; userStore.userDialog.visible = false;
@@ -238,7 +238,7 @@ export const useAuthStore = defineStore('Auth', () => {
relogin(user).then(() => { relogin(user).then(() => {
new Noty({ new Noty({
type: 'success', type: 'success',
text: 'Email 2FA resent.' text: t('message.auth.email_2fa_resent')
}).show(); }).show();
}); });
return; return;
@@ -246,7 +246,7 @@ export const useAuthStore = defineStore('Auth', () => {
} }
new Noty({ new Noty({
type: 'error', type: 'error',
text: 'Cannot send 2FA email without saved credentials. Please login again.' text: t('message.auth.email_2fa_no_credentials')
}).show(); }).show();
} }
@@ -462,7 +462,7 @@ export const useAuthStore = defineStore('Auth', () => {
try { try {
password = await checkPrimaryPassword(loginParams); password = await checkPrimaryPassword(loginParams);
} catch (err) { } catch (err) {
toast.error('Incorrect primary password'); toast.error(t('message.auth.incorrect_primary_password'));
throw err; throw err;
} }
} }
@@ -481,7 +481,7 @@ export const useAuthStore = defineStore('Auth', () => {
} }
} catch (err) { } catch (err) {
if (err.message.includes('Invalid Username/Email or Password')) { if (err.message.includes('Invalid Username/Email or Password')) {
toast.error('Saved credentials are no longer valid.'); toast.error(t('message.auth.saved_credentials_invalid'));
await deleteSavedLogin(user.user.id); await deleteSavedLogin(user.user.id);
} }
throw err; throw err;
@@ -506,7 +506,7 @@ export const useAuthStore = defineStore('Auth', () => {
); );
new Noty({ new Noty({
type: 'success', type: 'success',
text: 'Account removed.' text: t('message.auth.account_removed')
}).show(); }).show();
} }
@@ -824,7 +824,7 @@ export const useAuthStore = defineStore('Auth', () => {
} }
AppDebug.errorNoty = new Noty({ AppDebug.errorNoty = new Noty({
type: 'success', type: 'success',
text: 'Automatically logged in.' text: t('message.auth.auto_login_success')
}).show(); }).show();
console.log('Automatically logged in.'); console.log('Automatically logged in.');
}) })
@@ -834,15 +834,16 @@ export const useAuthStore = defineStore('Auth', () => {
} }
AppDebug.errorNoty = new Noty({ AppDebug.errorNoty = new Noty({
type: 'error', type: 'error',
text: 'Failed to login automatically.' text: t('message.auth.auto_login_failed')
}).show(); }).show();
console.error('Failed to login automatically.', err); console.error('Failed to login automatically.', err);
}) })
.finally(() => { .finally(() => {
attemptingAutoLogin.value = false;
if (!navigator.onLine) { if (!navigator.onLine) {
AppDebug.errorNoty = new Noty({ AppDebug.errorNoty = new Noty({
type: 'error', type: 'error',
text: `You're offline.` text: t('message.auth.offline')
}).show(); }).show();
console.error(`You're offline.`); console.error(`You're offline.`);
} }