mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-05 01:01:30 +02:00
Fix towards the new password expiration policy
This commit is contained in:
parent
ddfb8fed75
commit
6968bfafa2
7 changed files with 191 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue