File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
apps/sim/app/(auth)/login Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,13 @@ export default function LoginPage({
182182 e . preventDefault ( )
183183 setIsLoading ( true )
184184
185+ const redirectToVerify = ( emailToVerify : string ) => {
186+ if ( typeof window !== 'undefined' ) {
187+ sessionStorage . setItem ( 'verificationEmail' , emailToVerify )
188+ }
189+ router . push ( '/verify' )
190+ }
191+
185192 const formData = new FormData ( e . currentTarget )
186193 const emailRaw = formData . get ( 'email' ) as string
187194 const email = emailRaw . trim ( ) . toLowerCase ( )
@@ -213,9 +220,9 @@ export default function LoginPage({
213220 onError : ( ctx ) => {
214221 logger . error ( 'Login error:' , ctx . error )
215222
216- // EMAIL_NOT_VERIFIED is handled by the catch block which redirects to /verify
217223 if ( ctx . error . code ?. includes ( 'EMAIL_NOT_VERIFIED' ) ) {
218224 errorHandled = true
225+ redirectToVerify ( email )
219226 return
220227 }
221228
@@ -283,10 +290,7 @@ export default function LoginPage({
283290 router . push ( safeCallbackUrl )
284291 } catch ( err : any ) {
285292 if ( err . message ?. includes ( 'not verified' ) || err . code ?. includes ( 'EMAIL_NOT_VERIFIED' ) ) {
286- if ( typeof window !== 'undefined' ) {
287- sessionStorage . setItem ( 'verificationEmail' , email )
288- }
289- router . push ( '/verify' )
293+ redirectToVerify ( email )
290294 return
291295 }
292296
You can’t perform that action at this time.
0 commit comments