fix password checkings when pass policy is enabled
This commit is contained in:
parent
aee22eaf35
commit
297672ec48
|
@ -265,34 +265,11 @@ if ($create_user) {
|
||||||
$password_confirm = '';
|
$password_confirm = '';
|
||||||
$new_user = true;
|
$new_user = true;
|
||||||
} else {
|
} else {
|
||||||
if ($config['enable_pass_policy']) {
|
if ((!is_user_admin($config['id_user']) || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) {
|
||||||
$have_number = true;
|
$pass_ok = login_validate_pass($password_new, $id, true);
|
||||||
$have_simbols = true;
|
if ($pass_ok != 1) {
|
||||||
if ($config['pass_needs_numbers']) {
|
ui_print_error_message($pass_ok);
|
||||||
$nums = preg_match('/([[:alpha:]])*(\d)+(\w)*/', $password_confirm);
|
} else {
|
||||||
if ($nums == 0) {
|
|
||||||
ui_print_error_message(__('Password must contain numbers'));
|
|
||||||
$user_info = $values;
|
|
||||||
$password_new = '';
|
|
||||||
$password_confirm = '';
|
|
||||||
$new_user = true;
|
|
||||||
$have_number = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($config['pass_needs_symbols']) {
|
|
||||||
$symbols = preg_match('/(\w)*(\W)+(\w)*/', $password_confirm);
|
|
||||||
if ($symbols == 0) {
|
|
||||||
ui_print_error_message(__('Password must contain symbols'));
|
|
||||||
$user_info = $values;
|
|
||||||
$password_new = '';
|
|
||||||
$password_confirm = '';
|
|
||||||
$new_user = true;
|
|
||||||
$have_simbols = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($have_number && $have_simbols) {
|
|
||||||
$result = create_user($id, $password_new, $values);
|
$result = create_user($id, $password_new, $values);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue