forked from Yara724/api
Showing a valid message while the OTP is still valid, instead of 400
This commit is contained in:
@@ -34,9 +34,9 @@ export function userAuthErrorBody(code: UserAuthErrorCode) {
|
||||
}
|
||||
|
||||
export function throwUserAuthError(code: UserAuthErrorCode): never {
|
||||
if (code === UserAuthErrorCode.OTP_REQUEST_TOO_SOON) {
|
||||
throw new BadRequestException(userAuthErrorBody(code));
|
||||
}
|
||||
// if (code === UserAuthErrorCode.OTP_REQUEST_TOO_SOON) {
|
||||
// throw new BadRequestException(userAuthErrorBody(code));
|
||||
// }
|
||||
|
||||
if (code === UserAuthErrorCode.LINK_MOBILE_MISMATCH) {
|
||||
throw new ForbiddenException(userAuthErrorBody(code));
|
||||
|
||||
@@ -139,7 +139,8 @@ export class UserAuthService {
|
||||
}
|
||||
|
||||
if (isOtpExpiryActive(userExist.otpExpire, nowMs)) {
|
||||
throwUserAuthError(UserAuthErrorCode.OTP_REQUEST_TOO_SOON);
|
||||
// throwUserAuthError(UserAuthErrorCode.OTP_REQUEST_TOO_SOON);
|
||||
return new LoginDtoRs(userExist, "OTP Still valid");
|
||||
}
|
||||
|
||||
await this.smsSender(otp, canonicalMobile);
|
||||
|
||||
Reference in New Issue
Block a user