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": {
"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": {
"failed": "Failed to check for update, {message}",
"failed_install": "Failed to install update",

View File

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