diff options
author | Joas Schilling <coding@schilljs.com> | 2021-04-16 12:03:12 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-20 10:11:33 +0300 |
commit | 69290781ff0a59e72c1cf7c9c3b1c6a5ffc2596a (patch) | |
tree | a4e4355b32b5a25eea87ed3dd0c25d10e85fae8f /core/src | |
parent | adab9deb3e33307afa73dc6a3459eae24ec5955e (diff) |
Handle device login like an alternative login
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/login.js | 1 | ||||
-rw-r--r-- | core/src/views/Login.vue | 28 |
2 files changed, 23 insertions, 6 deletions
diff --git a/core/src/login.js b/core/src/login.js index 1b33c6dc5ae..c496c7476cf 100644 --- a/core/src/login.js +++ b/core/src/login.js @@ -69,6 +69,7 @@ new View({ resetPasswordUser: fromStateOr('resetPasswordUser', ''), directLogin: query.direct === '1', hasPasswordless: fromStateOr('webauthn-available', false), + countAlternativeLogins: fromStateOr('countAlternativeLogins', false), isHttps: window.location.protocol === 'https:', hasPublicKeyCredential: typeof (window.PublicKeyCredential) !== 'undefined', hideLoginForm: fromStateOr('hideLoginForm', false), diff --git a/core/src/views/Login.vue b/core/src/views/Login.vue index 6218aa7fe8b..90c163fc3d5 100644 --- a/core/src/views/Login.vue +++ b/core/src/views/Login.vue @@ -46,11 +46,23 @@ {{ t('core', 'Forgot password?') }} </a> <br> - <a v-if="hasPasswordless" - href="#" - @click.prevent="passwordlessLogin = true"> - {{ t('core', 'Log in with a device') }} - </a> + <template v-if="hasPasswordless"> + <div v-if="countAlternativeLogins" + class="alternative-logins"> + <a v-if="hasPasswordless" + class="button" + :class="{ 'single-alt-login-option': countAlternativeLogins }" + href="#" + @click.prevent="passwordlessLogin = true"> + {{ t('core', 'Log in with a device') }} + </a> + </div> + <a v-else + href="#" + @click.prevent="passwordlessLogin = true"> + {{ t('core', 'Log in with a device') }} + </a> + </template> </div> <div v-else-if="!loading && passwordlessLogin" key="reset" @@ -63,7 +75,7 @@ :is-https="isHttps" :has-public-key-credential="hasPublicKeyCredential" @submit="loading = true" /> - <a @click.prevent="passwordlessLogin = false" href="#"> + <a href="#" @click.prevent="passwordlessLogin = false"> {{ t('core', 'Back') }} </a> </div> @@ -156,6 +168,10 @@ export default { type: Boolean, default: false, }, + countAlternativeLogins: { + type: Number, + default: 0, + }, isHttps: { type: Boolean, default: false, |