feat: support default login url expiry
This commit is contained in:
@@ -6,7 +6,7 @@ require_once PLUGIN_ROOT . '/exec/lib/Settings.php';
|
||||
test('settings expose secure defaults from plugin-settings.conf', function (): void {
|
||||
$settings = Settings::fromArray([]);
|
||||
|
||||
assert_same(30, $settings->loginKeyTtl());
|
||||
assert_same(14400, $settings->loginKeyTtl());
|
||||
assert_true($settings->userIpBound());
|
||||
assert_true($settings->ipMask());
|
||||
assert_same('MASKED', $settings->auditClientIp('198.51.100.10'));
|
||||
@@ -22,7 +22,7 @@ test('settings runtime file is the directadmin plugin settings file', function (
|
||||
});
|
||||
|
||||
test('settings reject login key ttl outside production range', function (): void {
|
||||
foreach (['4', '301', 'abc'] as $ttl) {
|
||||
foreach (['4', '86401', 'abc'] as $ttl) {
|
||||
try {
|
||||
Settings::fromArray(['LOGIN_KEY_TTL' => $ttl]);
|
||||
throw new RuntimeException('Expected invalid TTL to fail: ' . $ttl);
|
||||
@@ -47,6 +47,12 @@ test('settings accept explicit ttl and user ip binding toggle', function (): voi
|
||||
assert_same(2, $settings->mxLoginMode());
|
||||
});
|
||||
|
||||
test('settings accept zero login key ttl as directadmin default expiry', function (): void {
|
||||
$settings = Settings::fromArray(['LOGIN_KEY_TTL' => '0']);
|
||||
|
||||
assert_same(0, $settings->loginKeyTtl());
|
||||
});
|
||||
|
||||
test('settings reject unsupported ip mask values', function (): void {
|
||||
foreach (['yes', '2', ''] as $mask) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user