2022-03-15 14:47:07 +01:00
|
|
|
<template>
|
2022-11-14 17:13:24 +01:00
|
|
|
<form-wrapper :title="$t('auth.webauthn.account_recovery')" :punchline="$t('auth.webauthn.recover_account_instructions')" >
|
|
|
|
<div>
|
|
|
|
<form @submit.prevent="recover" @keydown="form.onKeydown($event)">
|
|
|
|
<form-checkbox :form="form" fieldName="revokeAll" :label="$t('auth.webauthn.disable_all_security_devices')" :help="$t('auth.webauthn.disable_all_security_devices_help')" />
|
|
|
|
<form-password-field :form="form" :autocomplete="'current-password'" fieldName="password" :label="$t('auth.forms.current_password.label')" :help="$t('auth.forms.current_password.help')" />
|
|
|
|
<div class="field">
|
|
|
|
<p>{{ $t('auth.forms.forgot_your_password') }} <router-link id="lnkResetPwd" :to="{ name: 'password.request' }" class="is-link" :aria-label="$t('auth.forms.reset_your_password')">{{ $t('auth.forms.request_password_reset') }}</router-link></p>
|
2022-03-15 14:47:07 +01:00
|
|
|
</div>
|
2022-11-14 17:13:24 +01:00
|
|
|
<form-buttons :caption="$t('commons.continue')" :cancelLandingView="'login'" :showCancelButton="true" :isBusy="form.isBusy" :isDisabled="form.isDisabled" :submitId="'btnRecover'" />
|
|
|
|
</form>
|
2022-03-15 14:47:07 +01:00
|
|
|
</div>
|
2022-07-21 15:46:55 +02:00
|
|
|
<!-- footer -->
|
|
|
|
<vue-footer></vue-footer>
|
2022-03-15 14:47:07 +01:00
|
|
|
</form-wrapper>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import Form from './../../../components/Form'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
2022-11-14 17:13:24 +01:00
|
|
|
currentPassword: '',
|
2022-03-15 14:47:07 +01:00
|
|
|
deviceRegistered: false,
|
|
|
|
deviceId : null,
|
|
|
|
form: new Form({
|
2022-11-14 17:13:24 +01:00
|
|
|
email: '',
|
|
|
|
password: '',
|
|
|
|
token: '',
|
|
|
|
revokeAll: false,
|
2022-03-15 14:47:07 +01:00
|
|
|
}),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created () {
|
2022-11-14 17:13:24 +01:00
|
|
|
this.form.email = this.$route.query.email
|
|
|
|
this.form.token = this.$route.query.token
|
2022-03-15 14:47:07 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
methods : {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a new security device
|
|
|
|
*/
|
2022-11-14 17:13:24 +01:00
|
|
|
recover() {
|
|
|
|
this.form.post('/webauthn/recover', {returnError: true})
|
|
|
|
.then(response => {
|
|
|
|
this.$router.push({ name: 'login', params: { forceRefresh: true } })
|
|
|
|
})
|
2022-03-15 14:47:07 +01:00
|
|
|
.catch(error => {
|
2022-11-14 17:13:24 +01:00
|
|
|
if( error.response.status === 401 ) {
|
2022-03-15 14:47:07 +01:00
|
|
|
|
2022-11-14 17:13:24 +01:00
|
|
|
this.$notify({ type: 'is-danger', text: this.$t('auth.forms.authentication_failed'), duration:-1 })
|
2022-03-15 14:47:07 +01:00
|
|
|
}
|
2022-11-14 17:13:24 +01:00
|
|
|
else if (error.response.status === 422) {
|
|
|
|
this.$notify({ type: 'is-danger', text: error.response.data.message })
|
2022-03-15 14:47:07 +01:00
|
|
|
}
|
2022-11-14 17:13:24 +01:00
|
|
|
else {
|
|
|
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
2022-03-15 14:47:07 +01:00
|
|
|
}
|
2022-11-14 17:13:24 +01:00
|
|
|
});
|
|
|
|
}
|
2022-03-15 14:47:07 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
beforeRouteLeave (to, from, next) {
|
|
|
|
this.$notify({
|
|
|
|
clean: true
|
|
|
|
})
|
|
|
|
|
|
|
|
next()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|