9
9
<h2 class =" font-bold text-lg" >An error occured</h2 >
10
10
<span class =" text-sm" >{{ error_description }}</span >
11
11
</div >
12
- <VeeForm class =" space-y-6" method =" POST" :validation-schema =" schema" : action =" ` /api/auth/reset` " >
12
+ <VeeForm class =" space-y-6" method =" POST" :validation-schema =" schema" action =" /api/auth/reset" >
13
13
<input type =" hidden" name =" token" :value =" token" />
14
14
15
15
<h1 class =" font-bold text-2xl text-gray-50 text-center tracking-tight" >Reset your password</h1 >
37
37
<ButtonsPrimary type =" submit" class =" w-full" >Reset</ButtonsPrimary >
38
38
</VeeForm >
39
39
</div >
40
+ <div v-else-if =" success" >
41
+ <h1 class =" text-2xl font-bold tracking-tight text-gray-50 sm:text-4xl text-center" >Password reset
42
+ successful!
43
+ </h1 >
44
+ <p class =" mt-6 text-lg leading-8 text-gray-300 text-center" >
45
+ You can now login to your account with your new password.
46
+ </p >
47
+ </div >
40
48
<div v-else class =" mx-auto max-w-md" >
41
49
<h1 class =" text-2xl font-bold tracking-tight text-gray-50 sm:text-4xl" >Invalid access
42
50
parameters
@@ -59,12 +67,15 @@ import { toTypedSchema } from "@vee-validate/zod";
59
67
import { z } from " zod" ;
60
68
import LoginInput from " ../../components/LoginInput.vue" ;
61
69
70
+ const tokenData = useTokenData ();
71
+ tokenData .value = null ;
72
+
62
73
const schema = toTypedSchema (
63
- z . object ({
64
- password: z . string (). min ( 3 ),
65
- password2 : z .string ().min (3 ),
66
- token : z .string ().min (1 ),
67
- })
74
+ z
75
+ . object ({
76
+ password : z .string ().min (3 ). max ( 100 ),
77
+ password2 : z .string ().min (3 ). max ( 100 ),
78
+ })
68
79
.superRefine ((data , ctx ) => {
69
80
if (data .password !== data .password2 ) {
70
81
ctx .addIssue ({
@@ -81,10 +92,16 @@ const query = new URLSearchParams(
81
92
window ?.location .search ?? useRequestURL ().search ,
82
93
);
83
94
const token = query .get (" token" );
84
- const error = query .get (" error" );
85
- const error_description = query .get (" error_description" );
95
+ const login_reset = query .get (" login_reset" ) === " true" ;
96
+ const success = query .get (" success" ) === " true" ;
97
+ let error = query .get (" error" );
98
+ let error_description = query .get (" error_description" );
86
99
87
- const validUrlParameters = token ;
100
+ if (login_reset ) {
101
+ error = " Login reset" ;
102
+ error_description =
103
+ " Your password has been reset by an administrator. Please change it here." ;
104
+ }
88
105
89
- const ssoConfig = useSSOConfig () ;
106
+ const validUrlParameters = token ;
90
107
</script >
0 commit comments