|
| 1 | +<template> |
| 2 | + <!-- eslint-disable max-len --> |
| 3 | + <div class="auth-container"> |
| 4 | + <div class="auth-sub-container"> |
| 5 | + <div class="auth-sub-container-content" v-if="!passwordHasBeenReset"> |
| 6 | + <img src="../../assets/auth/refresh.png" class="h-12"> |
| 7 | + <h1 class="auth-sub-container-content-heading">Enter your new password</h1> |
| 8 | + </div> |
| 9 | + <div class="auth-sub-container-content" v-if="!passwordHasBeenReset"> |
| 10 | + <ValidationObserver v-slot="{ handleSubmit, invalid }"> |
| 11 | + <form @submit.prevent="handleSubmit(onSubmit)"> |
| 12 | + <ValidationProvider name="Password" rules="required|min:6|validPassword" v-slot="{errors}"> |
| 13 | + <input type="password" placeholder="New Password" v-model="formData.password" class="matcha-input mt-0"> |
| 14 | + <span class="matcha-input-error">{{ passwordErrorHandler(errors[0]) }}</span> |
| 15 | + </ValidationProvider> |
| 16 | + <input type="submit" :disabled="invalid" value="Reset password" v-bind:class="{'auth-sub-container-content-submit-button': true, 'opacity-50': invalid, 'cursor-pointer': !invalid}"> |
| 17 | + </form> |
| 18 | + </ValidationObserver> |
| 19 | + </div> |
| 20 | + <div class="auth-sub-container-content" v-if="passwordHasBeenReset"> |
| 21 | + <img src="../../assets/auth/success.png" class="h-12"> |
| 22 | + <h1 class="auth-sub-container-content-heading">Your password has been reset</h1> |
| 23 | + <router-link to="/accounts/signin" class="auth-sub-container-content-link">Sign in</router-link> |
| 24 | + </div> |
| 25 | + </div> |
| 26 | + </div> |
| 27 | +</template> |
| 28 | + |
| 29 | +<script> |
| 30 | +
|
| 31 | +export default { |
| 32 | + data: () => ({ |
| 33 | + formData: { |
| 34 | + password: '', |
| 35 | + }, |
| 36 | + passwordHasBeenReset: false, |
| 37 | + }), |
| 38 | + methods: { |
| 39 | + passwordErrorHandler(error) { |
| 40 | + if (!error || error === 'The Password field is required') { |
| 41 | + return error; |
| 42 | + } |
| 43 | + return 'This password is too easy to guess'; |
| 44 | + }, |
| 45 | + onSubmit() { |
| 46 | + this.passwordHasBeenReset = true; |
| 47 | + }, |
| 48 | + }, |
| 49 | +}; |
| 50 | +
|
| 51 | +</script> |
0 commit comments