From 0cee3a244c1f28fe34b8d25a25066c14cc09bccb Mon Sep 17 00:00:00 2001 From: isra el Date: Sat, 19 Oct 2024 11:18:16 +0300 Subject: [PATCH] chore(api): send generic error message response in password reset --- api/src/auth/auth.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/auth/auth.service.ts b/api/src/auth/auth.service.ts index fb3cb6a..eb7363a 100644 --- a/api/src/auth/auth.service.ts +++ b/api/src/auth/auth.service.ts @@ -31,7 +31,7 @@ export class AuthService { const user = await this.usersService.findOne({ email: userData.email }) if (!user) { throw new HttpException( - { error: 'User not found' }, + { error: 'Invalid credentials' }, HttpStatus.UNAUTHORIZED, ) } @@ -139,7 +139,9 @@ export class AuthService { async requestResetPassword({ email }: RequestResetPasswordInputDTO) { const user = await this.usersService.findOne({ email }) if (!user) { - throw new HttpException({ error: 'User not found' }, HttpStatus.NOT_FOUND) + return { + message: 'If email is found you will receive a password reset email', + } } const otp = Math.floor(100000 + Math.random() * 900000).toString()