diff --git a/dashboard/src/components/ProfileView.vue b/dashboard/src/components/ProfileView.vue index c289fa77b..d9a7dd645 100644 --- a/dashboard/src/components/ProfileView.vue +++ b/dashboard/src/components/ProfileView.vue @@ -14,40 +14,31 @@ - - + + + - - + + + - - + + + - - + + + - - - - - - + + + + +
{{ $t('main.username') }} - {{ user.username }}     - {{ $t('main.username') }}{{ user.username }}
{{ $t('main.displayName') }} - {{ user.displayName }} {{ $t('main.displayName') }}{{ user.displayName }}
{{ $t('profile.primaryEmail') }} - {{ user.email }} {{ $t('profile.primaryEmail') }}{{ user.email }}
{{ $t('profile.passwordRecoveryEmail') }} - {{ user.fallbackEmail }} - {{ $t('profile.passwordRecoveryEmail') }}{{ user.fallbackEmail }}
- {{ $t('profile.passwordResetAction') }} -
 
{{ $t('profile.language') }} - - {{ $t('profile.language') }}
@@ -146,6 +137,32 @@ async function onChangeEmail(currentEmail) { user.value = await profileModel.get(); } +async function onChangeFallbackEmail(currentFallbackEmail) { + const result = await inputDialog.value.prompt({ + message: [ t('profile.changeFallbackEmail.title'), t('profile.changeEmail.password') ], + type: [ 'email', 'password' ], + modal: false, + value: [ currentFallbackEmail, '' ], + confirmStyle: 'success', + confirmLabel: t('main.dialog.save'), + rejectLabel: t('main.dialog.cancel') + }); + + if (!result || !result[1] || currentFallbackEmail === result[0]) return; + + const error = await profileModel.setFallbackEmail(result[0], result[1]); + if (error) return console.error('Failed to set fallback email', error); + + user.value = await profileModel.get(); +} + +async function onPasswordReset() { + const error = await profileModel.sendPasswordReset(user.value.email); + if (error) return console.error('Failed to reset password:', error); + + window.pankow.notify({ type: 'success', timeout: 5000, text: t('profile.passwordResetNotification.title') + '. ' + t('profile.passwordResetNotification.body', { email: user.value.fallbackEmail || user.value.email }) }); +} +