show waiting state while redirecting to the OAuth 2.0 authorization page

This commit is contained in:
MaysWind
2025-10-23 00:42:29 +08:00
parent 234e7a55ff
commit b21fff5b15
4 changed files with 43 additions and 35 deletions
+10 -7
View File
@@ -47,13 +47,15 @@
</f7-list>
<f7-list class="margin-vertical-half">
<f7-list-button :class="{ 'disabled': inputIsEmpty || logining }" :text="tt('Log In')" @click="login" v-if="isInternalAuthEnabled()"></f7-list-button>
<f7-list-button :class="{ 'disabled': inputIsEmpty || loggingInByPassword || loggingInByOAuth2 }" :text="tt('Log In')"
@click="login" v-if="isInternalAuthEnabled()"></f7-list-button>
<f7-list-item class="login-divider display-flex align-items-center" v-if="isInternalAuthEnabled() && isOAuth2Enabled()">
<hr class="margin-inline-end-half" />
<small>{{ tt('or') }}</small>
<hr class="margin-inline-start-half" />
</f7-list-item>
<f7-list-button external :class="{ 'disabled': logining }" :href="oauth2LoginUrl" :text="oauth2LoginDisplayName" v-if="isOAuth2Enabled()"></f7-list-button>
<f7-list-button external :class="{ 'disabled': loggingInByPassword || loggingInByOAuth2 }" :href="oauth2LoginUrl" :text="oauth2LoginDisplayName"
@click="loggingInByOAuth2 = true" v-if="isOAuth2Enabled()"></f7-list-button>
<f7-block-footer v-if="isInternalAuthEnabled()">
<span>{{ tt('Don\'t have an account?') }}</span>&nbsp;
<f7-link :class="{'disabled': !isUserRegistrationEnabled()}" href="/signup" :text="tt('Create an account')"></f7-link>
@@ -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) {