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