File tree Expand file tree Collapse file tree 5 files changed +19
-7
lines changed Expand file tree Collapse file tree 5 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ const updateProfile = async () => {
137137 if (accountForm .value .email != user .value ?.email ) {
138138 const result = await turnstileModal .show ()
139139 if (! result .confirmed ) {
140+ turnstileRef .value ?.turnstile .reset ()
140141 loading .value = false
141142 return
142143 }
@@ -154,8 +155,9 @@ const updateProfile = async () => {
154155 console .error (error )
155156 // @ts-expect-error
156157 errors .value .account = error
157- turnstileRef .value ?.turnstile .reset ()
158158 }
159+
160+ turnstileRef .value ?.turnstile .reset ()
159161 }
160162
161163 try {
Original file line number Diff line number Diff line change @@ -81,7 +81,6 @@ const success = ref(false)
8181const fieldValidation = ref <Record <string , boolean >>({})
8282const form = ref ({
8383 email: ' ' ,
84- captcha: ' ' ,
8584})
8685
8786const handleFieldValidation = (field : string , isValid : boolean ) => {
@@ -95,22 +94,27 @@ const handleForgot = async () => {
9594
9695 const result = await turnstileModal .show ()
9796 if (! result .confirmed ) {
97+ turnstileRef .value ?.turnstile .reset ()
9898 loading .value = false
9999 return
100100 }
101101
102102 try {
103103 await $fetch (' /api/auth/password/forgot' , {
104104 method: ' POST' ,
105- body: form .value ,
105+ body: {
106+ email: form .value .email ,
107+ captcha: turnstileModal .captchaValue .value ,
108+ },
106109 })
107110 error .value = false
108111 success .value = true
109112 } catch {
110113 error .value = true
111114 success .value = false
112- turnstileRef .value ?.turnstile .reset ()
113115 }
116+
117+ turnstileRef .value ?.turnstile .reset ()
114118 loading .value = false
115119}
116120 </script >
Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ const handleLogin = async () => {
176176
177177 const result = await turnstileModal .show ()
178178 if (! result .confirmed ) {
179+ turnstileRef .value ?.turnstile .reset ()
179180 loading .value = false
180181 return
181182 }
@@ -190,9 +191,10 @@ const handleLogin = async () => {
190191 } catch (error ) {
191192 console .error (error )
192193 errors .value = error
193- turnstileRef .value ?.turnstile .reset ()
194194 } finally {
195195 loading .value = false
196196 }
197+
198+ turnstileRef .value ?.turnstile .reset ()
197199}
198200 </script >
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ const handleRegister = async () => {
142142
143143 const result = await turnstileModal .show ()
144144 if (! result .confirmed ) {
145+ turnstileRef .value ?.turnstile .reset ()
145146 loading .value = false
146147 return
147148 }
@@ -156,9 +157,10 @@ const handleRegister = async () => {
156157 } catch (error ) {
157158 console .error (error )
158159 errors .value = error
159- turnstileRef .value ?.turnstile .reset ()
160160 } finally {
161161 loading .value = false
162162 }
163+
164+ turnstileRef .value ?.turnstile .reset ()
163165}
164166 </script >
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ const handleResend = async () => {
128128
129129 const result = await turnstileModal .show ()
130130 if (! result .confirmed ) {
131+ turnstileRef .value ?.turnstile .reset ()
131132 loading .value = false
132133 return
133134 }
@@ -144,9 +145,10 @@ const handleResend = async () => {
144145 console .error (error )
145146 errors .value .resendError = true
146147 loading .value = false
147- turnstileRef .value ?.turnstile .reset ()
148148 } finally {
149149 loading .value = false
150150 }
151+
152+ turnstileRef .value ?.turnstile .reset ()
151153}
152154 </script >
You can’t perform that action at this time.
0 commit comments