Skip to content

Commit 5a9abec

Browse files
committed
view for resetting password
1 parent 228bfbe commit 5a9abec

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed
116 KB
Loading
125 KB
Loading

frontend/src/router/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import SignUp from '../views/auth/SignUp.vue';
55
import SignIn from '../views/auth/SignIn.vue';
66
import ForgotPassword from '../views/auth/ForgotPassword.vue';
77
import AccountVerified from '../views/auth/AccountVerified.vue';
8+
import ResetPassword from '../views/auth/ResetPassword.vue';
9+
import ResetPasswordError from '../views/auth/ResetPasswordError.vue';
810

911
Vue.use(VueRouter);
1012

@@ -29,6 +31,16 @@ const routes = [
2931
name: 'ForgotPassword',
3032
component: ForgotPassword,
3133
},
34+
{
35+
path: '/accounts/password/reset',
36+
name: 'ResetPassword',
37+
component: ResetPassword,
38+
},
39+
{
40+
path: '/accounts/password/reseterror',
41+
name: 'ResetPasswordError',
42+
component: ResetPasswordError,
43+
},
3244
{
3345
path: '/accounts/verified',
3446
name: 'AccountVerified',
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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

Comments
 (0)