diff --git a/frontend/src/components/account/FidoAuthForm.vue b/frontend/src/components/account/FidoAuthForm.vue
index 0102b4061..33a1e80ed 100644
--- a/frontend/src/components/account/FidoAuthForm.vue
+++ b/frontend/src/components/account/FidoAuthForm.vue
@@ -2,68 +2,90 @@
-
+
{{ $gettext('WebAuthn') }}
-
-
- {{
- $gettext(
- "You don't have any WebAuthN registered as a second authentication method."
- )
- }}
-
-
-
- {{ $gettext('Registered Webauthn devices') }}
-
-
- {{ $date(item.added_on) }}
+
+
+
+ {{
+ $gettext(
+ 'You must enable two-factor authentication using one-time passwords first.'
+ )
+ }}
+
+
+
+
+
+ {{
+ $gettext(
+ "You don't have any WebAuthN registered as a second authentication method."
+ )
+ }}
+
-
-
- {{ $gettext('Never') }}
+
+
+
+
+ {{ $gettext('Setup device') }}
+
+
+
+
+
+ {{
+ $gettext(
+ 'Your browser does not seem compatible with WebAuthN'
+ )
+ }}
+
+
+
+
+ {{ $gettext('Registered Webauthn devices') }}
+
+
+ {{ $date(item.added_on) }}
-
- {{ $date(item.last_used) }}
+
+
+ {{ $gettext('Never') }}
+
+
+ {{ $date(item.last_used) }}
+
-
-
-
- mdi-pencil
-
-
- mdi-delete
-
-
-
-
-
-
-
-
- {{ $gettext('Add WebAuthN device') }}
-
-
-
-
-
- {{
- $gettext('Your browser does not seem compatible with WebAuthN')
- }}
-
-
+
+ {{ $yesno(item.enabled) }}
+
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
+
+
+
@@ -111,7 +133,6 @@ const browserCapable = !!(
const fidoForm = ref()
const fidoCreds = computed(() => authStore.fidoCreds)
const headers = [
- { title: '#', key: 'id' },
{ title: $gettext('Name'), key: 'name' },
{ title: $gettext('Added On'), key: 'added_on' },
{ title: $gettext('Last Used'), key: 'last_used' },
@@ -133,21 +154,22 @@ async function startFidoRegistration() {
return
}
const creationOption = await authApi.beginFidoRegistration()
- console.log(creationOption)
if (creationOption) {
const options = parseCreationOptionsFromJSON(creationOption.data)
const result = await create(options)
const response = result.toJSON()
- response.name = name.value
console.log(response)
- authStore.addFidoCred(response)
+ response.name = name.value
+ await authStore.addFidoCred(response)
+ fidoForm.value.reset()
}
+ registrationLoading.value = false
}
async function deleteCred(cred) {
const result = await confirmDeletion.value.open(
$gettext('Warning'),
- $gettext('Do you really want to delete this WebaAuthn device?'),
+ $gettext('Do you really want to delete this WebAuthn device?'),
{
color: 'warning',
cancelLabel: $gettext('No'),
@@ -169,7 +191,7 @@ async function editCred(cred) {
editEnabled.value = cred.enabled
const result = await confirmEdition.value.open(
- $gettext('Edtion'),
+ $gettext('Edition'),
$gettext('Edit your device'),
{
color: 'warning',
diff --git a/frontend/src/components/account/TwoFactorAuthForm.vue b/frontend/src/components/account/TwoFactorAuthForm.vue
index d8d538029..833594fab 100644
--- a/frontend/src/components/account/TwoFactorAuthForm.vue
+++ b/frontend/src/components/account/TwoFactorAuthForm.vue
@@ -2,8 +2,8 @@
-
- {{ $gettext('Two factor authentication') }}
+
+ {{ $gettext('One-time passwords') }}
@@ -37,7 +37,10 @@
}}
{{ $gettext('Pin code') }}
-
+
{{ $gettext('Register') }}
@@ -48,27 +51,31 @@
{{
$gettext(
- 'Congratulations! Two-Factor Authentication is now enabled for your account.'
+ 'Congratulations! Two-factor authentication using one-time passwords is now enabled for your account.'
)
}}
-
+
{{
$gettext(
"The following recovery codes can be used one time each to let you regain access to your account, in case you lose your phone for example. Make sure to save them in a safe place, otherwise you won't be able to access your account anymore."
)
}}
-
+
+
+
+ {{ token }}
+
+
+
{{
- $gettext('Two-Factor Authentication is enabled for your account.')
+ $gettext(
+ 'Two-factor authentication using one-time passwords is enabled for your account.'
+ )
}}
@@ -100,12 +107,12 @@
{{
$gettext(
- "Two-Factor Authentication (2FA) is not yet activated for your account. Enabling this feature will increase your account's security."
+ 'Two-factor authentication (2FA) using one-time passwords is not yet activated for your account.'
)
}}
- {{ $gettext('Enable 2FA') }}
+ {{ $gettext('Register authenticator') }}
@@ -136,7 +143,7 @@ const editTFAForm = ref()
const newTokens = ref([])
const pinCode = ref('')
-const pinCodeErrors = ref()
+const pinCodeErrors = ref([])
const key = ref(null)
const qrURL = ref(null)
const clicked = ref(false)
@@ -167,7 +174,7 @@ function startTFASetup() {
})
}
-async function finalizeTFASetup() {
+function finalizeTFASetup() {
authStore
.finalizeTFASetup(pinCode.value)
.then((response) => {
@@ -177,7 +184,7 @@ async function finalizeTFASetup() {
})
.catch((error) => {
if (error.response.status === 400) {
- pinCodeErrors.value = error.response.data
+ pinCodeErrors.value = error.response.data.pin_code
}
})
}
diff --git a/frontend/src/stores/auth.store.js b/frontend/src/stores/auth.store.js
index f0d3966f4..efc809e9f 100644
--- a/frontend/src/stores/auth.store.js
+++ b/frontend/src/stores/auth.store.js
@@ -140,17 +140,14 @@ export const useAuthStore = defineStore('auth', () => {
})
}
- async function finalizeTFASetup(pinCode) {
- return accountApi
- .finalizeTFASetup(pinCode)
- .then((response) => {
- const cookie = Cookies.withAttributes({ sameSite: 'strict' })
- cookie.set('token', response.data.access)
- cookie.set('refreshToken', response.data.refresh)
- initialize()
- return response
- })
- .catch((error) => error)
+ function finalizeTFASetup(pinCode) {
+ return accountApi.finalizeTFASetup(pinCode).then((response) => {
+ const cookie = Cookies.withAttributes({ sameSite: 'strict' })
+ cookie.set('token', response.data.access)
+ cookie.set('refreshToken', response.data.refresh)
+ fetchUser()
+ return response
+ })
}
return {
diff --git a/frontend/src/views/account/SettingsView.vue b/frontend/src/views/account/SettingsView.vue
index a33203059..00218d095 100644
--- a/frontend/src/views/account/SettingsView.vue
+++ b/frontend/src/views/account/SettingsView.vue
@@ -1,48 +1,47 @@
-
- {{ $gettext('Account settings') }}
-
-
-
-
- {{ $gettext('Profile') }}
-
-
- {{ $gettext('Security') }}
-
-
- {{ $gettext('Forward') }}
-
-
- {{ $gettext('Auto-reply message') }}
-
-
- {{ $gettext('API access') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ {{ $gettext('Account settings') }}
+
+
+
+
+ {{ $gettext('Profile') }}
+
+
+ {{ $gettext('Two-factor auth') }}
+
+
+ {{ $gettext('Forward') }}
+
+
+ {{ $gettext('Auto-reply message') }}
+
+
+ {{ $gettext('API access') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+