File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
packages/features/auth/lib Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -169,21 +169,15 @@ const providers: Provider[] = [
169169 identifier : hashEmail ( user . email ) ,
170170 } ) ;
171171
172- if ( ! user . password ?. hash && user . identityProvider !== IdentityProvider . CAL && ! credentials . totpCode ) {
173- throw new Error ( ErrorCode . IncorrectEmailPassword ) ;
174- }
175- if ( ! user . password ?. hash && user . identityProvider == IdentityProvider . CAL ) {
172+ // Users without a password must use their identity provider (Google/SAML) to login
173+ if ( ! user . password ?. hash ) {
176174 throw new Error ( ErrorCode . IncorrectEmailPassword ) ;
177175 }
178176
179- if ( user . password ?. hash && ! credentials . totpCode ) {
180- if ( ! user . password ?. hash ) {
181- throw new Error ( ErrorCode . IncorrectEmailPassword ) ;
182- }
183- const isCorrectPassword = await verifyPassword ( credentials . password , user . password . hash ) ;
184- if ( ! isCorrectPassword ) {
185- throw new Error ( ErrorCode . IncorrectEmailPassword ) ;
186- }
177+ // Always verify password for users who have one
178+ const isCorrectPassword = await verifyPassword ( credentials . password , user . password . hash ) ;
179+ if ( ! isCorrectPassword ) {
180+ throw new Error ( ErrorCode . IncorrectEmailPassword ) ;
187181 }
188182
189183 if ( user . twoFactorEnabled && credentials . backupCode ) {
You can’t perform that action at this time.
0 commit comments