@@ -48,9 +48,14 @@ export class RouterAuthService {
4848
4949 private trackingService = inject ( TrackingService ) ;
5050
51+ private getTrimmedEmail ( email : string ) : string {
52+ return email . trim ( ) . toLowerCase ( ) ;
53+ }
54+
5155 checkEmailExists ( email : string ) : Observable < EmailExistsResponse > {
56+ const trimmedEmail = this . getTrimmedEmail ( email ) ;
5257 return this . routerApiService . post < EmailExistsResponse > ( '/auth/basic/email_exists' , {
53- email,
58+ email : trimmedEmail ,
5459 } ) ;
5560 }
5661
@@ -96,8 +101,9 @@ export class RouterAuthService {
96101 }
97102
98103 sendResetPassword ( email : string ) : Observable < { } > {
104+ const trimmedEmail = this . getTrimmedEmail ( email ) ;
99105 return this . routerApiService . post < { } > ( '/auth/send_reset_password' , {
100- email,
106+ email : trimmedEmail ,
101107 } ) ;
102108 }
103109
@@ -110,9 +116,10 @@ export class RouterAuthService {
110116 }
111117
112118 basicSignin ( email : string , password : string ) : Observable < AuthResponse > {
119+ const trimmedEmail = this . getTrimmedEmail ( email ) ;
113120 return this . routerApiService
114121 . post < AuthResponse > ( '/auth/basic/signin' , {
115- email,
122+ email : trimmedEmail ,
116123 password,
117124 } )
118125 . pipe ( switchMap ( ( res ) => from ( this . handleSignInResponse ( res ) ) . pipe ( map ( ( ) => res ) ) ) ) ;
@@ -144,8 +151,9 @@ export class RouterAuthService {
144151 }
145152
146153 resendVerificationLink ( email : string , orgId : string ) : Observable < ResendEmailVerification > {
154+ const trimmedEmail = this . getTrimmedEmail ( email ) ;
147155 return this . routerApiService . post < ResendEmailVerification > ( '/auth/resend_email_verification' , {
148- email : email ?. trim ( ) . toLowerCase ( ) ,
156+ email : trimmedEmail ,
149157 org_id : orgId ,
150158 } ) ;
151159 }
0 commit comments