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:
@@ -69,6 +69,16 @@ final class AuthTest extends ApiTestCase
|
||||
self::assertCount(1, $this->sentEmails());
|
||||
}
|
||||
|
||||
public function test_the_resend_interval_is_configurable(): void
|
||||
{
|
||||
$this->reconfigure(['MAGIC_LINK_RESEND_SECONDS' => '0']);
|
||||
|
||||
$this->request('POST', '/api/auth/magic-link', ['email' => 'ada@example.com']);
|
||||
$this->request('POST', '/api/auth/magic-link', ['email' => 'ada@example.com']);
|
||||
|
||||
self::assertCount(2, $this->sentEmails());
|
||||
}
|
||||
|
||||
public function test_me_requires_a_valid_token(): void
|
||||
{
|
||||
$unauthorised = $this->request('GET', '/api/me');
|
||||
|
||||
Reference in New Issue
Block a user