feat: support default login url expiry

This commit is contained in:
Marek Miklewicz
2026-06-30 20:21:53 +02:00
parent e2814fd81c
commit 4a1c9d0db4
7 changed files with 35 additions and 11 deletions
+4 -4
View File
@@ -62,7 +62,7 @@ final class Settings
'MAIL_LOGIN_TARGET_NAME' => 'mx1',
'MAIL_LOGIN_TARGET_BASE_URL' => 'https://mx1.mojserwer.pl:2222',
'MAIL_LOGIN_REDIRECT_URL' => '/',
'LOGIN_KEY_TTL' => '30',
'LOGIN_KEY_TTL' => '14400',
'USER_IP_BOUND' => '1',
'IP_MASK' => '1',
'MAIL_LOGIN_SOURCE_SERVER_NAME' => '',
@@ -128,7 +128,7 @@ final class Settings
public function loginKeyTtl(): int
{
return (int)$this->getString('LOGIN_KEY_TTL', '30');
return (int)$this->getString('LOGIN_KEY_TTL', '14400');
}
public function userIpBound(): bool
@@ -252,8 +252,8 @@ final class Settings
throw new InvalidArgumentException('LOGIN_KEY_TTL must be an integer');
}
$ttl = (int)$ttlRaw;
if ($ttl < 5 || $ttl > 300) {
throw new InvalidArgumentException('LOGIN_KEY_TTL must be between 5 and 300 seconds');
if ($ttl !== 0 && ($ttl < 5 || $ttl > 86400)) {
throw new InvalidArgumentException('LOGIN_KEY_TTL must be 0 or between 5 and 86400 seconds');
}
if (!in_array($this->getString('USER_IP_BOUND', ''), ['0', '1'], true)) {
throw new InvalidArgumentException('USER_IP_BOUND must be 0 or 1');