diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-17 11:19:51 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-19 11:19:48 +0100 |
commit | 60dd89e04cf876ca6027ba6200387b014007df81 (patch) | |
tree | 0a0eb17f1f46f4a018256f55ef5faaf36b7d3797 | |
parent | 823551d5c3d9b134586a1874c14f88d57e887658 (diff) | |
download | nextcloud-server-60dd89e04cf876ca6027ba6200387b014007df81.tar.gz nextcloud-server-60dd89e04cf876ca6027ba6200387b014007df81.zip |
fix(core): adjust fronend code for changes in webauthn library
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/settings/src/service/WebAuthnRegistrationSerice.ts | 6 | ||||
-rw-r--r-- | core/src/components/login/PasswordLessLoginForm.vue | 14 | ||||
-rw-r--r-- | core/src/services/WebAuthnAuthenticationService.ts | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/apps/settings/src/service/WebAuthnRegistrationSerice.ts b/apps/settings/src/service/WebAuthnRegistrationSerice.ts index 7e881ce61e2..8f9e085310c 100644 --- a/apps/settings/src/service/WebAuthnRegistrationSerice.ts +++ b/apps/settings/src/service/WebAuthnRegistrationSerice.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { RegistrationResponseJSON } from '@simplewebauthn/types' +import type { PublicKeyCredentialCreationOptionsJSON, RegistrationResponseJSON } from '@simplewebauthn/types' import { translate as t } from '@nextcloud/l10n' import { generateUrl } from '@nextcloud/router' @@ -21,9 +21,9 @@ export async function startRegistration() { try { logger.debug('Fetching webauthn registration data') - const { data } = await axios.get(url) + const { data } = await axios.get<PublicKeyCredentialCreationOptionsJSON>(url) logger.debug('Start webauthn registration') - const attrs = await registerWebAuthn(data) + const attrs = await registerWebAuthn({ optionsJSON: data }) return attrs } catch (e) { logger.error(e as Error) diff --git a/core/src/components/login/PasswordLessLoginForm.vue b/core/src/components/login/PasswordLessLoginForm.vue index d87f0ce8cb9..bbca2ebf31d 100644 --- a/core/src/components/login/PasswordLessLoginForm.vue +++ b/core/src/components/login/PasswordLessLoginForm.vue @@ -5,11 +5,15 @@ <template> <form v-if="(isHttps || isLocalhost) && supportsWebauthn" ref="loginForm" + aria-labelledby="password-less-login-form-title" class="password-less-login-form" method="post" name="login" @submit.prevent="submit"> - <h2>{{ t('core', 'Log in with a device') }}</h2> + <h2 id="password-less-login-form-title"> + {{ t('core', 'Log in with a device') }} + </h2> + <NcTextField required :value="user" :autocomplete="autoCompleteAllowed ? 'on' : 'off'" @@ -41,9 +45,11 @@ </NcEmptyContent> </template> -<script> +<script type="ts"> import { browserSupportsWebAuthn } from '@simplewebauthn/browser' +import { defineComponent } from 'vue' import { + NoValidCredentials, startAuthentication, finishAuthentication, } from '../../services/WebAuthnAuthenticationService.ts' @@ -56,7 +62,7 @@ import LoginButton from './LoginButton.vue' import LockOpenIcon from 'vue-material-design-icons/LockOpen.vue' import logger from '../../logger' -export default { +export default defineComponent({ name: 'PasswordLessLoginForm', components: { LoginButton, @@ -143,7 +149,7 @@ export default { // noop }, }, -} +}) </script> <style lang="scss" scoped> diff --git a/core/src/services/WebAuthnAuthenticationService.ts b/core/src/services/WebAuthnAuthenticationService.ts index 82a07ae35ad..7563e264109 100644 --- a/core/src/services/WebAuthnAuthenticationService.ts +++ b/core/src/services/WebAuthnAuthenticationService.ts @@ -27,7 +27,7 @@ export async function startAuthentication(loginName: string) { logger.error('No valid credentials returned for webauthn') throw new NoValidCredentials() } - return await startWebauthnAuthentication(data) + return await startWebauthnAuthentication({ optionsJSON: data }) } /** |