File tree Expand file tree Collapse file tree 4 files changed +52
-2
lines changed
Expand file tree Collapse file tree 4 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import SignUp from '../views/auth/SignUp.vue';
55import SignIn from '../views/auth/SignIn.vue' ;
66import ForgotPassword from '../views/auth/ForgotPassword.vue' ;
77import AccountVerified from '../views/auth/AccountVerified.vue' ;
8+ import AccountVerifiedError from '../views/auth/AccountVerifiedError.vue' ;
89import ResetPassword from '../views/auth/ResetPassword.vue' ;
910import ResetPasswordError from '../views/auth/ResetPasswordError.vue' ;
1011
@@ -46,6 +47,11 @@ const routes = [
4647 name : 'AccountVerified' ,
4748 component : AccountVerified ,
4849 } ,
50+ {
51+ path : '/accounts/verify/error' ,
52+ name : 'AccountVerifiedError' ,
53+ component : AccountVerifiedError ,
54+ } ,
4955] ;
5056
5157const router = new VueRouter ( {
Original file line number Diff line number Diff line change 11<template >
22 <!-- eslint-disable max-len -->
3- <div class =" auth-container" >
3+ <div class =" auth-container" v-if = " verified " >
44 <div class =" auth-sub-container" >
55 <div class =" auth-sub-container-content" >
66 <h1 class =" auth-sub-container-content-heading" >You are now verified</h1 >
1313<script >
1414
1515export default {
16+ data : () => ({
17+ verified: false ,
18+ }),
19+ async created () {
20+ try {
21+ await this .checkToken ();
22+ await this .verifyUser ();
23+ this .verified = true ;
24+ } catch (error) {
25+ await this .$router .push (' /accounts/verify/error' );
26+ }
27+ },
28+ methods: {
29+ async checkToken () {
30+ const { token } = this .$route .query ;
31+ if (! token) {
32+ await this .$router .push (' /accounts/verify/error' );
33+ }
34+ },
35+ async verifyUser () {
36+ const { token } = this .$route .query ;
37+ await this .$http .post (` /auth/confirm/${ token} ` , {});
38+ },
39+ },
1640};
1741
1842 </script >
Original file line number Diff line number Diff line change 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" >
6+ <img src =" ../../assets/auth/error.png" class =" h-12" >
7+ <h1 class =" auth-sub-container-content-heading" >Something is wrong</h1 >
8+ <h1 class =" text-sm text-gray-matcha text-center" >Either user has been verified already or this request is invalid</h1 >
9+ <router-link to =" /accounts/signin" class =" auth-sub-container-content-link mt-4" >Sign in</router-link >
10+ </div >
11+ </div >
12+ <div class =" auth-sub-container-thinner mt-4" >
13+ <div class =" auth-sub-container-content" >
14+ <router-link to =" /accounts/signup" class =" auth-sub-container-content-link" >Sign up</router-link >
15+ </div >
16+ </div >
17+ </div >
18+ </template >
Original file line number Diff line number Diff line change 11<template >
22 <!-- eslint-disable max-len -->
3- <div class =" auth-container" >
3+ <div class =" auth-container" v-if = " tokenIsValid " >
44 <div class =" auth-sub-container-error" v-if =" error.happened" >
55 <h1 class =" auth-sub-container-error-message" >{{error.message}}</h1 >
66 </div >
4343export default {
4444 async created () {
4545 await this .checkToken ();
46+ this .tokenIsValid = true ;
4647 },
4748 data : () => ({
49+ tokenIsValid: false ,
4850 formData: {
4951 password: ' ' ,
5052 passwordRepeat: ' ' ,
You can’t perform that action at this time.
0 commit comments