summaryrefslogtreecommitdiff
path: root/website/src/actions/otp/send-otp.ts
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-01-24 10:09:31 +0000
committerJoe Carstairs <me@joeac.net>2026-01-24 10:09:31 +0000
commit9c7ed56823a4ba02d9e70f3a9dc4f00c9987add3 (patch)
treea772540aed771031b403e610bd936d633a0e0deb /website/src/actions/otp/send-otp.ts
parent9c9b20a38a51da764d4f99091a06ffc4085ce58f (diff)
adds console warn when email exceeds max daily load
Diffstat (limited to 'website/src/actions/otp/send-otp.ts')
-rw-r--r--website/src/actions/otp/send-otp.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/website/src/actions/otp/send-otp.ts b/website/src/actions/otp/send-otp.ts
index 2022990..2781061 100644
--- a/website/src/actions/otp/send-otp.ts
+++ b/website/src/actions/otp/send-otp.ts
@@ -29,6 +29,9 @@ async function sendOtp({ email, name }: OtpParams) {
gte(SentEmails.sentAt, Date.now() - 1000 * 60 * 60 * 24),
);
if (emailsSentLast24Hours >= MAX_DAILY_EMAILS) {
+ console.warn(
+ `${name} <${email}> requested an OTP, but ${emailsSentLast24Hours} have already been sent, whereas the max daily load is ${MAX_DAILY_EMAILS}.`,
+ );
throw new Error(
`${emailsSentLast24Hours} emails have been sent in the last 24 hours, but the max daily load is ${MAX_DAILY_EMAILS}.`,
);