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

@ -90,7 +90,7 @@ class PasswordController extends Controller
if (!checkPasswordComplexity($data['password2'])) {
redirect()->route('update.password',[],['selector'=>urlencode($data['selector']),'token'=>urlencode($data['token'])])->with('error','Password too weak. Use a stronger password.');
}
$_SESSION['password_last_changed'][$userId] = time();
$db->exec('UPDATE users SET password_last_updated = NOW() WHERE id = ?', [$userId]);
Auth::resetPasswordUpdate($data['selector'], $data['token'], $data['password']);
}
@ -113,7 +113,7 @@ class PasswordController extends Controller
redirect()->route('profile')->with('error','Password too weak. Use a stronger password.');
}
$userId = $container->get('auth')->user()['id'];
$_SESSION['password_last_changed'][$userId] = time();
$db->exec('UPDATE users SET password_last_updated = NOW() WHERE id = ?', [$userId]);
Auth::changeCurrentPassword($data['old_password'], $data['new_password']);
}
}