Make the magic-link resend cooldown configurable

EmailVerifier::RESEND_INTERVAL_SECONDS was a hardcoded class constant
shared (via a copy-of-a-constant) by AuthController and
EmailVerificationController. It's now a constructor param
(resendIntervalSeconds, default 60, same as before) sourced from
Config -- new MAGIC_LINK_RESEND_SECONDS env var, default unchanged.

Docker Compose sets it to 0, so magic links resend immediately during
local development instead of waiting out the throttle.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 21:30:41 +01:00
co-authored by Claude Sonnet 5
parent 4a9717caa5
commit 91c0e8d6af
9 changed files with 31 additions and 7 deletions
+1 -1
View File
@@ -83,6 +83,6 @@ final class AuthController extends Controller
$lastSent = $user['verification_email_sent_at'] ?? null;
return $lastSent !== null
&& (time() - (int) strtotime($lastSent)) < EmailVerifier::RESEND_INTERVAL_SECONDS;
&& (time() - (int) strtotime($lastSent)) < $this->verifier->resendIntervalSeconds;
}
}