mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 16:14:55 +00:00
added cooldown to data
This commit is contained in:
@ -169,9 +169,12 @@ export class UserAuthService {
|
||||
const timeSinceLastOtp = differenceInSeconds(now, lastOtp.createdAt);
|
||||
|
||||
if (timeSinceLastOtp < cooldown) {
|
||||
throw new BadRequestException(
|
||||
`Please wait ${cooldown - timeSinceLastOtp} more seconds before requesting a new OTP.`,
|
||||
);
|
||||
throw new BadRequestException({
|
||||
message: `Please wait ${cooldown - timeSinceLastOtp} more seconds before requesting a new OTP.`,
|
||||
data: {
|
||||
cooldown: cooldown - timeSinceLastOtp,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
const otpCode = Math.floor(100000 + Math.random() * 900000).toString();
|
||||
|
||||
Reference in New Issue
Block a user