Added excluded password utility
This commit is contained in:
parent
dc38e2e50a
commit
381dea9b54
|
@ -701,7 +701,13 @@ function delete_user($id_user)
|
||||||
function update_user_password($user, $password_new)
|
function update_user_password($user, $password_new)
|
||||||
{
|
{
|
||||||
global $config;
|
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(
|
$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."'"
|
"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);
|
$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');
|
$config['auth_error'] = __('Could not changes password on remote pandora');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ if (isset($_GET['modified']) && !$view_mode) {
|
||||||
$user_info = $upd_info;
|
$user_info = $upd_info;
|
||||||
} else {
|
} else {
|
||||||
if (!$error_msg) {
|
if (!$error_msg) {
|
||||||
$error_msg = __('Error updating passwords: ');
|
$error_msg = __('Error updating passwords: ').($config['auth_error'] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_auth_error = $config['auth_error'];
|
$user_auth_error = $config['auth_error'];
|
||||||
|
|
Loading…
Reference in New Issue