21 lines
622 B
PHP
21 lines
622 B
PHP
<?php
|
|
|
|
namespace Modules\Core\Auth\Exceptions;
|
|
|
|
use RuntimeException;
|
|
|
|
/**
|
|
* Thrown by Modules\Core\Auth\Services\UserOtpService::generateAndSend()
|
|
* when an email has requested too many codes too quickly — caps both
|
|
* mail-bombing one inbox and the "just request a fresh code to reset my
|
|
* guess count" loophole a per-code attempt cap alone doesn't close.
|
|
*/
|
|
class OtpThrottledException extends RuntimeException
|
|
{
|
|
public function __construct(
|
|
public readonly int $availableInSeconds,
|
|
) {
|
|
parent::__construct("Too many code requests. Try again in {$availableInSeconds} second(s).");
|
|
}
|
|
}
|