Update functions.php
This commit is contained in:
parent
6a46b541dc
commit
c2f60a0407
|
|
@ -998,13 +998,21 @@ function format_string ($format, $data) {
|
|||
}
|
||||
|
||||
//check password strength against requirements (if any)
|
||||
function check_password_strength($password, $text) {
|
||||
function check_password_strength($password, $text, $type = 'default') {
|
||||
if ($password != '') {
|
||||
$req['length'] = $_SESSION['security']['password_length']['numeric'];
|
||||
$req['number'] = ($_SESSION['security']['password_number']['boolean'] == 'true') ? true : false;
|
||||
$req['lowercase'] = ($_SESSION['security']['password_lowercase']['boolean'] == 'true') ? true : false;
|
||||
$req['uppercase'] = ($_SESSION['security']['password_uppercase']['boolean'] == 'true') ? true : false;
|
||||
$req['special'] = ($_SESSION['security']['password_special']['boolean'] == 'true') ? true : false;
|
||||
if ($type == 'default') {
|
||||
$req['length'] = $_SESSION['security']['password_length']['numeric'];
|
||||
$req['number'] = ($_SESSION['security']['password_number']['boolean'] == 'true') ? true : false;
|
||||
$req['lowercase'] = ($_SESSION['security']['password_lowercase']['boolean'] == 'true') ? true : false;
|
||||
$req['uppercase'] = ($_SESSION['security']['password_uppercase']['boolean'] == 'true') ? true : false;
|
||||
$req['special'] = ($_SESSION['security']['password_special']['boolean'] == 'true') ? true : false;
|
||||
} elseif ($type == 'user') {
|
||||
$req['length'] = $_SESSION['user']['password_length']['numeric'];
|
||||
$req['number'] = ($_SESSION['user']['password_number']['boolean'] == 'true') ? true : false;
|
||||
$req['lowercase'] = ($_SESSION['user']['password_lowercase']['boolean'] == 'true') ? true : false;
|
||||
$req['uppercase'] = ($_SESSION['user']['password_uppercase']['boolean'] == 'true') ? true : false;
|
||||
$req['special'] = ($_SESSION['user']['password_special']['boolean'] == 'true') ? true : false;
|
||||
}
|
||||
if (is_numeric($req['length']) && $req['length'] != 0 && !preg_match_all('$\S*(?=\S{'.$req['length'].',})\S*$', $password)) { // length
|
||||
$msg_errors[] = $req['length'].'+ '.$text['label-characters'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue