Twofactor authentication and strong password
This commit is contained in:
@@ -304,3 +304,62 @@ function unique_multidim_array( $array, $key )
|
||||
|
||||
return $temp_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate password strength
|
||||
* Password must contain:
|
||||
* - At least 8 characters
|
||||
* - At least 1 uppercase letter
|
||||
* - At least 1 lowercase letter
|
||||
* - At least 1 number
|
||||
* - At least 1 special character
|
||||
*
|
||||
* @param string $password The password to validate
|
||||
* @return bool True if password meets all requirements
|
||||
*/
|
||||
if ( ! function_exists( 'validate_password_strength' ) )
|
||||
{
|
||||
function validate_password_strength( $password )
|
||||
{
|
||||
if ( strlen( $password ) < 8 ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! preg_match( '/[A-Z]/', $password ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! preg_match( '/[a-z]/', $password ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! preg_match( '/[0-9]/', $password ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! preg_match( '/[^A-Za-z0-9]/', $password ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password validation requirements in Dutch
|
||||
*
|
||||
* @return array Array of password requirements
|
||||
*/
|
||||
if ( ! function_exists( 'get_password_requirements_nl' ) )
|
||||
{
|
||||
function get_password_requirements_nl()
|
||||
{
|
||||
return [
|
||||
'Minimaal 8 karakters',
|
||||
'Minimaal 1 hoofdletter',
|
||||
'Minimaal 1 kleine letter',
|
||||
'Minimaal 1 cijfer',
|
||||
'Minimaal 1 speciaal teken (!@#$%^&* etc.)'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user