Fix towards the new password expiration policy

This commit is contained in:
Pinga 2025-02-11 23:37:17 +02:00
parent ddfb8fed75
commit 6968bfafa2
7 changed files with 191 additions and 9 deletions

View file

@ -703,9 +703,17 @@ function checkPasswordRenewal($lastPasswordUpdateTimestamp) {
// Use configured or default password expiration days
$passwordExpiryDays = envi('PASSWORD_EXPIRATION_DAYS') ?: 90; // Default to 90 days
if (time() - $lastPasswordUpdateTimestamp > $passwordExpiryDays * 86400) {
if (!$lastPasswordUpdateTimestamp) {
return 'Your password is expired. Please change it.';
}
// Convert the timestamp string to a Unix timestamp
$lastUpdatedUnix = strtotime($lastPasswordUpdateTimestamp);
if (time() - $lastUpdatedUnix > $passwordExpiryDays * 86400) {
return 'Your password is expired. Please change it.';
}
return null;
}