mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 10:24:53 +00:00
fixed forgot password
This commit is contained in:
@ -76,11 +76,14 @@ export class UserAuthController {
|
||||
|
||||
@Post('user/forget-password')
|
||||
async forgetPassword(@Body() forgetPasswordDto: ForgetPasswordDto) {
|
||||
const otpResult = await this.userAuthService.verifyOTP({
|
||||
otpCode: forgetPasswordDto.otpCode,
|
||||
email: forgetPasswordDto.email,
|
||||
type: OtpType.PASSWORD,
|
||||
});
|
||||
const otpResult = await this.userAuthService.verifyOTP(
|
||||
{
|
||||
otpCode: forgetPasswordDto.otpCode,
|
||||
email: forgetPasswordDto.email,
|
||||
type: OtpType.PASSWORD,
|
||||
},
|
||||
true,
|
||||
);
|
||||
if (otpResult) {
|
||||
await this.userAuthService.forgetPassword(forgetPasswordDto);
|
||||
return {
|
||||
@ -89,11 +92,11 @@ export class UserAuthController {
|
||||
message: 'Password changed successfully',
|
||||
};
|
||||
}
|
||||
throw new BadRequestException({
|
||||
statusCode: HttpStatus.BAD_REQUEST,
|
||||
data: {},
|
||||
message: 'Otp is incorrect',
|
||||
})
|
||||
throw new BadRequestException({
|
||||
statusCode: HttpStatus.BAD_REQUEST,
|
||||
data: {},
|
||||
message: 'Otp is incorrect',
|
||||
});
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
|
||||
Reference in New Issue
Block a user