diff --git a/src/views/base/LoginPageBase.ts b/src/views/base/LoginPageBase.ts index d7912890..6fe66938 100644 --- a/src/views/base/LoginPageBase.ts +++ b/src/views/base/LoginPageBase.ts @@ -29,7 +29,8 @@ export function useLoginPageBase(platform: 'mobile' | 'desktop') { const twoFAVerifyType = ref('passcode'); const oauth2ClientSessionId = ref(''); - const logining = ref(false); + const loggingInByPassword = ref(false); + const loggingInByOAuth2 = ref(false); const verifying = ref(false); const inputIsEmpty = computed(() => !username.value || !password.value); @@ -73,7 +74,8 @@ export function useLoginPageBase(platform: 'mobile' | 'desktop') { tempToken, twoFAVerifyType, oauth2ClientSessionId, - logining, + loggingInByPassword, + loggingInByOAuth2, verifying, // computed states inputIsEmpty, diff --git a/src/views/desktop/LoginPage.vue b/src/views/desktop/LoginPage.vue index 162d9841..5521114e 100644 --- a/src/views/desktop/LoginPage.vue +++ b/src/views/desktop/LoginPage.vue @@ -36,7 +36,7 @@ type="text" autocomplete="username" :autofocus="true" - :disabled="show2faInput || logining || verifying" + :disabled="show2faInput || loggingInByPassword || loggingInByOAuth2 || verifying" :label="tt('Username')" :placeholder="tt('Your username or email')" v-model="username" @@ -50,7 +50,7 @@ autocomplete="current-password" ref="passwordInput" type="password" - :disabled="show2faInput || logining || verifying" + :disabled="show2faInput || loggingInByPassword || loggingInByOAuth2 || verifying" :label="tt('Password')" :placeholder="tt('Your password')" v-model="password" @@ -64,7 +64,7 @@ type="number" autocomplete="one-time-code" ref="passcodeInput" - :disabled="logining || verifying" + :disabled="loggingInByPassword || loggingInByOAuth2 || verifying" :label="tt('Passcode')" :placeholder="tt('Passcode')" :append-inner-icon="mdiHelpCircleOutline" @@ -75,7 +75,7 @@ /> - {{ tt('Log In') }} - + @@ -112,10 +112,12 @@ - + {{ oauth2LoginDisplayName }} + - {{ tt('Continue') }} @@ -140,7 +142,7 @@ - + @@ -212,7 +214,8 @@ const { tempToken, twoFAVerifyType, oauth2ClientSessionId, - logining, + loggingInByPassword, + loggingInByOAuth2, verifying, inputIsEmpty, twoFAInputIsEmpty, @@ -247,17 +250,17 @@ function login(): void { return; } - if (logining.value) { + if (loggingInByPassword.value) { return; } - logining.value = true; + loggingInByPassword.value = true; rootStore.authorize({ loginName: username.value, password: password.value }).then(authResponse => { - logining.value = false; + loggingInByPassword.value = false; if (authResponse.need2FA) { tempToken.value = authResponse.token; @@ -276,7 +279,7 @@ function login(): void { doAfterLogin(authResponse); router.replace('/'); }).catch(error => { - logining.value = false; + loggingInByPassword.value = false; if (isUserVerifyEmailEnabled() && error.error && error.error.errorCode === KnownErrorCode.UserEmailNotVerified && error.error.context && error.error.context.email) { router.push(`/verify_email?email=${encodeURIComponent(error.error.context.email)}&emailSent=${error.error.context.hasValidEmailVerifyToken || false}`); diff --git a/src/views/desktop/OAuth2CallbackPage.vue b/src/views/desktop/OAuth2CallbackPage.vue index d1798370..6b9bba50 100644 --- a/src/views/desktop/OAuth2CallbackPage.vue +++ b/src/views/desktop/OAuth2CallbackPage.vue @@ -38,7 +38,7 @@ type="password" autocomplete="password" :autofocus="true" - :disabled="logining" + :disabled="loggingInByOAuth2" :label="tt('Password')" :placeholder="tt('Your password')" v-model="password" @@ -47,15 +47,15 @@ - + {{ tt('Continue') }} - + + :class="{ 'disabled': loggingInByOAuth2 }"> {{ tt('Back to login page') }} @@ -71,7 +71,7 @@ - + @@ -146,7 +146,7 @@ const rootStore = useRootStore(); const { version, password, - logining, + loggingInByOAuth2, doAfterLogin } = useLoginPageBase('desktop'); @@ -197,17 +197,17 @@ function verifyAndLogin(): void { return; } - logining.value = true; + loggingInByOAuth2.value = true; rootStore.authorizeOAuth2({ password: password.value, token: props.token || '' }).then(authResponse => { - logining.value = false; + loggingInByOAuth2.value = false; doAfterLogin(authResponse); navigateToHome(); }).catch(error => { - logining.value = false; + loggingInByOAuth2.value = false; if (isUserVerifyEmailEnabled() && error.error && error.error.errorCode === KnownErrorCode.UserEmailNotVerified && error.error.context && error.error.context.email) { router.push(`/verify_email?email=${encodeURIComponent(error.error.context.email)}&emailSent=${error.error.context.hasValidEmailVerifyToken || false}`); @@ -221,16 +221,16 @@ function verifyAndLogin(): void { } if (!error.value && props.platform && props.token && !props.userName) { - logining.value = true; + loggingInByOAuth2.value = true; rootStore.authorizeOAuth2({ token: props.token }).then(authResponse => { - logining.value = false; + loggingInByOAuth2.value = false; doAfterLogin(authResponse); navigateToHome(); }).catch(error => { - logining.value = false; + loggingInByOAuth2.value = false; if (isUserVerifyEmailEnabled() && error.error && error.error.errorCode === KnownErrorCode.UserEmailNotVerified && error.error.context && error.error.context.email) { router.push(`/verify_email?email=${encodeURIComponent(error.error.context.email)}&emailSent=${error.error.context.hasValidEmailVerifyToken || false}`); diff --git a/src/views/mobile/LoginPage.vue b/src/views/mobile/LoginPage.vue index 4f6926e1..1aca6b45 100644 --- a/src/views/mobile/LoginPage.vue +++ b/src/views/mobile/LoginPage.vue @@ -47,13 +47,15 @@ - + - + {{ tt('Don\'t have an account?') }}  @@ -212,7 +214,8 @@ const { tempToken, twoFAVerifyType, oauth2ClientSessionId, - logining, + loggingInByPassword, + loggingInByOAuth2, verifying, inputIsEmpty, twoFAInputIsEmpty, @@ -258,17 +261,17 @@ function login(): void { return; } - logining.value = true; + loggingInByPassword.value = true; resendVerifyEmail.value = ''; hasValidEmailVerifyToken.value = false; currentPasswordForResendVerifyEmail.value = ''; - showLoading(() => logining.value); + showLoading(() => loggingInByPassword.value); rootStore.authorize({ loginName: username.value, password: password.value }).then(authResponse => { - logining.value = false; + loggingInByPassword.value = false; hideLoading(); if (authResponse.need2FA) { @@ -280,7 +283,7 @@ function login(): void { doAfterLogin(authResponse); router.refreshPage(); }).catch(error => { - logining.value = false; + loggingInByPassword.value = false; hideLoading(); if (isUserVerifyEmailEnabled() && error.error && error.error.errorCode === KnownErrorCode.UserEmailNotVerified && error.error.context && error.error.context.email) {