fix(sso|auth): fix sso signinup (#9651)
Renamed `user` to `payload` for better context clarity and updated related references. Adjusted the login token generation to use `workspace.id`, improving readability and maintainability of the code.
This commit is contained in:
@ -137,7 +137,7 @@ export class SSOAuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async generateLoginToken(
|
private async generateLoginToken(
|
||||||
user: { email: string } & Record<string, string>,
|
payload: { email: string } & Record<string, string>,
|
||||||
identityProvider: WorkspaceSSOIdentityProvider,
|
identityProvider: WorkspaceSSOIdentityProvider,
|
||||||
) {
|
) {
|
||||||
if (!identityProvider) {
|
if (!identityProvider) {
|
||||||
@ -149,16 +149,16 @@ export class SSOAuthController {
|
|||||||
|
|
||||||
const existingUser = await this.userRepository.findOne({
|
const existingUser = await this.userRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
email: user.email,
|
email: payload.email,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { userData } = this.authService.formatUserDataPayload(
|
const { userData } = this.authService.formatUserDataPayload(
|
||||||
user,
|
payload,
|
||||||
existingUser,
|
existingUser,
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.authService.signInUp({
|
const { workspace, user } = await this.authService.signInUp({
|
||||||
userData,
|
userData,
|
||||||
workspace: identityProvider.workspace,
|
workspace: identityProvider.workspace,
|
||||||
authParams: {
|
authParams: {
|
||||||
@ -170,7 +170,7 @@ export class SSOAuthController {
|
|||||||
identityProvider,
|
identityProvider,
|
||||||
loginToken: await this.loginTokenService.generateLoginToken(
|
loginToken: await this.loginTokenService.generateLoginToken(
|
||||||
user.email,
|
user.email,
|
||||||
identityProvider.workspace.id,
|
workspace.id,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user