|
10 | 10 | <h1 class="auth-sub-container-content-heading">Forgot password?</h1> |
11 | 11 | <h1 class="text-sm text-gray-matcha text-center">Enter your email and we will send you a link, so you can log in again</h1> |
12 | 12 | </div> |
13 | | - <div class="auth-sub-container-content mt-4" v-if="!forgotPasswordEmailSent"> |
14 | | - <ValidationObserver v-slot="{ handleSubmit, invalid }"> |
| 13 | + <div class="auth-sub-container-content mt-4 w-full" v-if="!forgotPasswordEmailSent"> |
| 14 | + <ValidationObserver v-slot="{ handleSubmit, invalid }" class="w-full"> |
15 | 15 | <form @submit.prevent="handleSubmit(onSubmit)"> |
16 | 16 | <ValidationProvider name="Email" rules="required|email|max:50" v-slot="{errors}"> |
17 | 17 | <input type="email" placeholder="Email" v-model="formData.email" class="matcha-input"> |
18 | 18 | <span class="matcha-input-error">{{ errors[0] }}</span> |
19 | 19 | </ValidationProvider> |
20 | | - <input type="submit" :disabled="invalid" value="Send reset link" v-bind:class="{'auth-sub-container-content-submit-button': true, 'opacity-50': invalid, 'cursor-pointer': !invalid}"> |
| 20 | + <input v-if="!submitted" type="submit" :disabled="invalid" value="Send reset link" v-bind:class="{'auth-sub-container-content-submit-button': true, 'opacity-50': invalid, 'cursor-pointer': !invalid}"> |
| 21 | + <div v-else class="flex items-center justify-center mt-4"> |
| 22 | + <img class="h-12" src="../../assets/loading.svg"> |
| 23 | + </div> |
21 | 24 | </form> |
22 | 25 | </ValidationObserver> |
23 | 26 | </div> |
@@ -47,15 +50,19 @@ export default { |
47 | 50 | happened: false, |
48 | 51 | message: '', |
49 | 52 | }, |
| 53 | + submitted: false, |
50 | 54 | }), |
51 | 55 | methods: { |
52 | 56 | async onSubmit() { |
53 | 57 | try { |
| 58 | + this.submitted = true; |
54 | 59 | this.clearError(); |
55 | 60 | await this.sendResetPasswordLink(); |
56 | 61 | this.forgotPasswordEmailSent = true; |
| 62 | + this.submitted = false; |
57 | 63 | } catch (error) { |
58 | 64 | this.displayError(this.$errorMessenger(error)); |
| 65 | + this.submitted = false; |
59 | 66 | } |
60 | 67 | }, |
61 | 68 | async sendResetPasswordLink() { |
|
0 commit comments