diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index e8982b170..45f3e681d 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -20,38 +20,63 @@ - + - + + + + + + + + + + + + + {{ validationContext.errors[0] }} + + + + + - - + + - -
    @@ -90,8 +115,11 @@ export default { name: 'reset', data() { return { + form: { + password: '', + passwordRepeat: '', + }, password: '', - checkPassword: '', passwordVisible: false, submitted: false, authenticated: false, @@ -100,13 +128,16 @@ export default { } }, methods: { + getValidationState({ dirty, validated, valid = null }) { + return dirty || validated ? valid : null + }, togglePasswordVisibility() { this.passwordVisible = !this.passwordVisible }, async onSubmit() { - const result = await loginAPI.changePassword(this.sessionId, this.email, this.password) + const result = await loginAPI.changePassword(this.sessionId, this.email, this.form.password) if (result.success) { - this.password = '' + this.form.password = '' /* this.$store.dispatch('login', { sessionId: result.result.data.session_id, @@ -132,10 +163,10 @@ export default { }, computed: { samePasswords() { - return this.password === this.checkPassword + return this.form.password === this.form.passwordRepeat }, passwordsFilled() { - return this.password !== '' && this.checkPassword !== '' + return this.form.password !== '' && this.form.passwordRepeat !== '' }, rules() { return [ @@ -148,7 +179,7 @@ export default { passwordValidation() { const errors = [] for (const condition of this.rules) { - if (!condition.regex.test(this.password)) { + if (!condition.regex.test(this.form.password)) { errors.push(condition.message) } }