mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed password strength validation for the Unicode symbols;
This commit is contained in:
@@ -162,19 +162,24 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Password test
|
||||
* Password strength test
|
||||
*
|
||||
* @param $candidate
|
||||
* @param string $candidate
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function strong_pass( $candidate ) {
|
||||
$r1='/[A-Z]/';
|
||||
$r2='/[a-z]/';
|
||||
$r3='/[0-9]/';
|
||||
if(preg_match_all($r1,$candidate, $o)<1) return false;
|
||||
if(preg_match_all($r2,$candidate, $o)<1) return false;
|
||||
if(preg_match_all($r3,$candidate, $o)<1) return false;
|
||||
// are used Unicode Regular Expressions
|
||||
$regexps = [
|
||||
'/[\p{Lu}]/u', // any Letter Uppercase symbol
|
||||
'/[\p{Ll}]/u', // any Letter Lowercase symbol
|
||||
'/[\p{N}]/u', // any Number symbol
|
||||
];
|
||||
foreach ( $regexps as $regexp ) {
|
||||
if ( preg_match_all( $regexp, $candidate, $o ) < 1 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user