feat: add mode parameter to social auth to distinguish between login and signup flows
This commit is contained in:
@@ -256,8 +256,13 @@ export class AuthService {
|
||||
where: { id: user.id },
|
||||
data: { [providerIdField]: dto.providerId },
|
||||
});
|
||||
} else if (dto.mode === 'login') {
|
||||
// Login mode: user must exist
|
||||
throw new BadRequestException(
|
||||
'No account found with this email. Please sign up first.',
|
||||
);
|
||||
} else {
|
||||
// Create new user
|
||||
// Create new user (signup mode)
|
||||
const role = dto.role === 'AGENT' ? UserRole.AGENT : UserRole.USER;
|
||||
const authProvider =
|
||||
dto.provider === 'google'
|
||||
|
||||
Reference in New Issue
Block a user