The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Check password in signinup only when email/password signInUp (#5042)
martmull36d4c38c3d0e
diff --git a/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.ts b/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.tsindex 610f45cdc90..cd44cd54e94 100644--- a/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.ts@@ -97,7 +97,10 @@ export class AuthResolver {@Mutation(() => LoginToken)async signUp(@Args() signUpInput: SignUpInput): Promise<LoginToken> {- const user = await this.authService.signInUp(signUpInput);+ const user = await this.authService.signInUp({+ ...signUpInput,+ fromSSO: false,+ });const loginToken = await this.tokenService.generateLoginToken(user.email);diff --git a/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.ts b/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.tsindex 447a65af1ff..28943d2e75d 100644--- a/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.ts@@ -34,6 +34,7 @@ export class GoogleAuthController {lastName,picture,workspaceInviteHash,+ fromSSO: true,});const loginToken = await this.tokenService.generateLoginToken(user.email);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.tsindex f2905a6f805..9b6301e6de0 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@@ -87,6 +87,7 @@ export class AuthService {firstName,lastName,picture,+ fromSSO,}: {email: string;password?: string;@@ -94,6 +95,7 @@ export class AuthService {lastName?: string | null;workspaceInviteHash?: string | null;picture?: string | null;+ fromSSO: boolean;}) {return await this.signInUpService.signInUp({email,@@ -102,6 +104,7 @@ export class AuthService {lastName,workspaceInviteHash,picture,+ fromSSO,});}diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.tsindex afcddf2c902..cb3f9cb3db6 100644--- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts+++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts@@ -32,6 +32,7 @@ export type SignInUpServiceInput = {lastName?: string | null;workspaceInviteHash?: string | null;picture?: string | null;+ fromSSO: boolean;};@Injectable()@@ -54,6 +55,7 @@ export class SignInUpService {firstName,lastName,picture,+ fromSSO,}: SignInUpServiceInput) {if (!firstName) firstName = '';if (!lastName) lastName = '';@@ -80,7 +82,7 @@ export class SignInUpService {relations: ['defaultWorkspace'],});- if (existingUser && existingUser.passwordHash) {+ if (existingUser && !fromSSO) {const isValid = await compareHash(password || '',existingUser.passwordHash,