Skip to content

Commit

Permalink
chore: signin error alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-w committed Mar 18, 2024
1 parent fae9eb0 commit 58fd704
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/nestjs-backend/src/features/auth/auth.service.ts
Expand Up @@ -40,11 +40,11 @@ export class AuthService {

async validateUserByEmail(email: string, pass: string) {
const user = await this.userService.getUserByEmail(email);
if (user) {
const { password, salt, ...result } = user;
return (await this.comparePassword(pass, password, salt)) ? result : null;
if (!user) {
throw new BadRequestException(`${email} not registered`);
}
return null;
const { password, salt, ...result } = user;
return (await this.comparePassword(pass, password, salt)) ? result : null;
}

async signup(email: string, password: string) {
Expand Down

0 comments on commit 58fd704

Please sign in to comment.