support Nextcloud OAuth 2.0 authentication
This commit is contained in:
@@ -24,14 +24,14 @@
|
||||
<v-card variant="flat" class="w-100 mt-0 px-4 pt-12" max-width="500">
|
||||
<v-card-text>
|
||||
<h4 class="text-h4 mb-2">{{ tt('Welcome to ezBookkeeping') }}</h4>
|
||||
<p class="mb-0">{{ tt('Please log in with your ezBookkeeping account') }}</p>
|
||||
<p class="mb-0" v-if="isInternalAuthEnabled()">{{ tt('Please log in with your ezBookkeeping account') }}</p>
|
||||
<p class="mt-1 mb-0" v-if="tips">{{ tips }}</p>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-text class="pb-0 mb-6">
|
||||
<v-form>
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-col cols="12" v-if="isInternalAuthEnabled()">
|
||||
<v-text-field
|
||||
type="text"
|
||||
autocomplete="username"
|
||||
@@ -45,7 +45,7 @@
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-col cols="12" v-if="isInternalAuthEnabled()">
|
||||
<v-text-field
|
||||
autocomplete="current-password"
|
||||
ref="passwordInput"
|
||||
@@ -101,10 +101,20 @@
|
||||
|
||||
<v-col cols="12">
|
||||
<v-btn block :disabled="inputIsEmpty || logining || verifying"
|
||||
@click="login" v-if="!show2faInput">
|
||||
@click="login" v-if="isInternalAuthEnabled() && !show2faInput">
|
||||
{{ tt('Log In') }}
|
||||
<v-progress-circular indeterminate size="22" class="ms-2" v-if="logining"></v-progress-circular>
|
||||
</v-btn>
|
||||
|
||||
<v-col cols="12" class="d-flex align-center px-0" v-if="isInternalAuthEnabled() && isOAuth2Enabled()">
|
||||
<v-divider class="me-3" />
|
||||
{{ tt('or') }}
|
||||
<v-divider class="ms-3" />
|
||||
</v-col>
|
||||
|
||||
<v-btn block :disabled="logining || verifying" :href="oauth2LoginUrl" v-if="isOAuth2Enabled()">
|
||||
{{ oauth2LoginDisplayName }}
|
||||
</v-btn>
|
||||
<v-btn block :disabled="twoFAInputIsEmpty || logining || verifying"
|
||||
@click="verify" v-else-if="show2faInput">
|
||||
{{ tt('Continue') }}
|
||||
@@ -112,7 +122,7 @@
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" class="text-center text-base">
|
||||
<v-col cols="12" class="text-center text-base" v-if="isInternalAuthEnabled()">
|
||||
<span class="me-1">{{ tt('Don\'t have an account?') }}</span>
|
||||
<router-link class="text-primary" to="/signup"
|
||||
:class="{'disabled': !isUserRegistrationEnabled()}">
|
||||
@@ -170,7 +180,14 @@ import { ThemeType } from '@/core/theme.ts';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
|
||||
import { isUserRegistrationEnabled, isUserForgetPasswordEnabled, isUserVerifyEmailEnabled } from '@/lib/server_settings.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
isUserRegistrationEnabled,
|
||||
isUserForgetPasswordEnabled,
|
||||
isUserVerifyEmailEnabled,
|
||||
isInternalAuthEnabled,
|
||||
isOAuth2Enabled
|
||||
} from '@/lib/server_settings.ts';
|
||||
|
||||
import {
|
||||
mdiOnepassword,
|
||||
@@ -194,13 +211,16 @@ const {
|
||||
backupCode,
|
||||
tempToken,
|
||||
twoFAVerifyType,
|
||||
oauth2ClientSessionId,
|
||||
logining,
|
||||
verifying,
|
||||
inputIsEmpty,
|
||||
twoFAInputIsEmpty,
|
||||
oauth2LoginUrl,
|
||||
oauth2LoginDisplayName,
|
||||
tips,
|
||||
doAfterLogin
|
||||
} = useLoginPageBase();
|
||||
} = useLoginPageBase('desktop');
|
||||
|
||||
const passwordInput = useTemplateRef<VTextField>('passwordInput');
|
||||
const passcodeInput = useTemplateRef<VTextField>('passcodeInput');
|
||||
@@ -301,4 +321,6 @@ function verify(): void {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
oauth2ClientSessionId.value = generateRandomUUID();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user