Skip to content

The open alternative to Salesforce, designed for AI.

Fix: Password validation requires data and hash arguments (#18189)

sonarly[bot]20d997bc5a6f
diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
index b75ddf1d849..9db13451815 100644
--- a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
@@ -227,6 +227,15 @@ export class AuthService {
}
if (userData.type === 'existingUser') {
+ if (!userData.existingUser.passwordHash) {
+ throw new AuthException(
+ 'Incorrect login method',
+ AuthExceptionCode.INVALID_INPUT,
+ {
+ userFriendlyMessage: msg`User was not created with email/password`,
+ },
+ );
+ }
await this.signInUpService.validatePassword({
password: authParams.password,
passwordHash: userData.existingUser.passwordHash,