From 24209c4374108a198d7bc936d6048fc0abd2ee86 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 24 Aug 2024 12:48:20 +0000 Subject: [PATCH] Issue 14381: Fix automated register policy on first install --- src/Module/Register.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Module/Register.php b/src/Module/Register.php index 56139be07a..0dbc16e1f5 100644 --- a/src/Module/Register.php +++ b/src/Module/Register.php @@ -435,13 +435,14 @@ class Register extends BaseModule } public static function getPolicy(): int { + $admins = User::getAdminList(['login_date']); $days = DI::config()->get('system', 'admin_inactivity_limit'); - if ($days == 0) { + if ($days == 0 || empty($admins)) { return intval(DI::config()->get('config', 'register_policy')); } $inactive_since = DateTimeFormat::utc('now - ' . $days . ' day'); - foreach (User::getAdminList(['login_date']) as $admin) { + foreach ($admins as $admin) { if (strtotime($admin['login_date']) > strtotime($inactive_since)) { return intval(DI::config()->get('config', 'register_policy')); }