55<template >
66 <form v-if =" (isHttps || isLocalhost) && supportsWebauthn"
77 ref =" loginForm"
8+ aria-labelledby =" password-less-login-form-title"
9+ class =" password-less-login-form"
810 method =" post"
911 name =" login"
1012 @submit.prevent =" submit" >
11- <h2 >{{ t('core', 'Log in with a device') }}</h2 >
12- <fieldset >
13- <NcTextField required
14- :value =" user"
15- :autocomplete =" autoCompleteAllowed ? 'on' : 'off'"
16- :error =" !validCredentials"
17- :label =" t('core', 'Login or email')"
18- :placeholder =" t('core', 'Login or email')"
19- :helper-text =" !validCredentials ? t('core', 'Your account is not setup for passwordless login.') : ''"
20- @update:value =" changeUsername" />
13+ <h2 id =" password-less-login-form-title" >
14+ {{ t('core', 'Log in with a device') }}
15+ </h2 >
2116
22- <LoginButton v-if =" validCredentials"
23- :loading =" loading"
24- @click =" authenticate" />
25- </fieldset >
17+ <NcTextField required
18+ :value =" user"
19+ :autocomplete =" autoCompleteAllowed ? 'on' : 'off'"
20+ :error =" !validCredentials"
21+ :label =" t('core', 'Login or email')"
22+ :placeholder =" t('core', 'Login or email')"
23+ :helper-text =" !validCredentials ? t('core', 'Your account is not setup for passwordless login.') : ''"
24+ @update:value =" changeUsername" />
25+
26+ <LoginButton v-if =" validCredentials"
27+ :loading =" loading"
28+ @click =" authenticate" />
2629 </form >
2730 <div v-else-if =" !supportsWebauthn" class =" update" >
2831 <InformationIcon size =" 70" />
4043 </div >
4144</template >
4245
43- <script >
46+ <script type="ts" >
4447import { browserSupportsWebAuthn } from ' @simplewebauthn/browser'
48+ import { defineComponent } from ' vue'
4549import {
50+ NoValidCredentials ,
4651 startAuthentication ,
4752 finishAuthentication ,
4853} from ' ../../services/WebAuthnAuthenticationService.ts'
@@ -52,7 +57,7 @@ import LockOpenIcon from 'vue-material-design-icons/LockOpen.vue'
5257import NcTextField from ' @nextcloud/vue/dist/Components/NcTextField.js'
5358import logger from ' ../../logger'
5459
55- export default {
60+ export default defineComponent ( {
5661 name: ' PasswordLessLoginForm' ,
5762 components: {
5863 LoginButton,
@@ -138,21 +143,21 @@ export default {
138143 // noop
139144 },
140145 },
141- }
146+ })
142147 </script >
143148
144149<style lang="scss" scoped>
145- fieldset {
146- display : flex ;
147- flex-direction : column ;
148- gap : 0.5rem ;
150+ .password-less-login-form {
151+ display : flex ;
152+ flex-direction : column ;
153+ gap : 0.5rem ;
149154
150- :deep (label ) {
151- text-align : initial ;
152- }
155+ :deep (label ) {
156+ text-align : initial ;
153157 }
158+ }
154159
155- .update {
156- margin : 0 auto ;
157- }
160+ .update {
161+ margin : 0 auto ;
162+ }
158163 </style >
0 commit comments