Added excluded password utility

This commit is contained in:
José González 2022-10-04 16:54:34 +02:00
parent dc38e2e50a
commit 381dea9b54
2 changed files with 9 additions and 3 deletions

View File

@ -701,7 +701,13 @@ function delete_user($id_user)
function update_user_password($user, $password_new)
{
global $config;
if (isset($config['auth']) && $config['auth'] == 'pandora') {
if (excludedPassword($password_new) === true) {
$config['auth_error'] = __('The password provided is not valid. Please, set another one.');
return false;
}
if (isset($config['auth']) === true && $config['auth'] === 'pandora') {
$sql = sprintf(
"UPDATE tusuario SET password = '".md5($password_new)."', last_pass_change = '".date('Y-m-d H:i:s', get_system_time())."' WHERE id_user = '".$user."'"
);
@ -714,7 +720,7 @@ function update_user_password($user, $password_new)
);
$remote_pass_update = db_process_sql($sql, 'affected_rows', $connection);
if (!$remote_pass_update) {
if ((bool) $remote_pass_update === false) {
$config['auth_error'] = __('Could not changes password on remote pandora');
return false;
}

View File

@ -211,7 +211,7 @@ if (isset($_GET['modified']) && !$view_mode) {
$user_info = $upd_info;
} else {
if (!$error_msg) {
$error_msg = __('Error updating passwords: ');
$error_msg = __('Error updating passwords: ').($config['auth_error'] ?? '');
}
$user_auth_error = $config['auth_error'];