mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-26 06:09:41 +00:00
refactor: remove login by password and biometric
This commit is contained in:
@ -260,10 +260,14 @@ export class AuthService {
|
||||
this.logger.log(`Passcode updated successfully for user with email ${email}`);
|
||||
}
|
||||
|
||||
async login(loginDto: LoginRequestDto, deviceId: string): Promise<[ILoginResponse, User]> {
|
||||
async login(loginDto: LoginRequestDto): Promise<[ILoginResponse, User]> {
|
||||
let user: User;
|
||||
let tokens: ILoginResponse;
|
||||
|
||||
if (loginDto.grantType === GrantType.PASSWORD || loginDto.grantType === GrantType.BIOMETRIC) {
|
||||
throw new BadRequestException('AUTH.GRANT_TYPE_NOT_SUPPORTED_YET');
|
||||
}
|
||||
|
||||
if (loginDto.grantType === GrantType.GOOGLE) {
|
||||
this.logger.log(`Logging in user with email ${loginDto.email} using google`);
|
||||
[tokens, user] = await this.loginWithGoogle(loginDto);
|
||||
@ -274,22 +278,6 @@ export class AuthService {
|
||||
[tokens, user] = await this.loginWithApple(loginDto);
|
||||
}
|
||||
|
||||
if (loginDto.grantType === GrantType.PASSWORD) {
|
||||
this.logger.log(`Logging in user with email ${loginDto.email} using password`);
|
||||
[tokens, user] = await this.loginWithPassword(loginDto);
|
||||
}
|
||||
|
||||
if (loginDto.grantType === GrantType.BIOMETRIC) {
|
||||
this.logger.log(`Logging in user with email ${loginDto.email} using biometric`);
|
||||
[tokens, user] = await this.loginWithBiometric(loginDto, deviceId);
|
||||
}
|
||||
|
||||
await this.deviceService.updateDevice(deviceId, {
|
||||
lastAccessOn: new Date(),
|
||||
fcmToken: loginDto.fcmToken,
|
||||
userId: user!.id,
|
||||
});
|
||||
|
||||
this.logger.log(`User with email ${loginDto.email} logged in successfully`);
|
||||
|
||||
return [tokens!, user!];
|
||||
|
Reference in New Issue
Block a user