add things from 27-03-26
This commit is contained in:
@@ -1,22 +1,5 @@
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Check password strength (1/2)
|
||||
* @param string $password password to check
|
||||
* @return bool - true or false
|
||||
*/
|
||||
function isStrongPassword(string $password): bool
|
||||
{
|
||||
// min. 8 Zeichen, 1 Kleinbuchstabe, 1 Großbuchstabe, 1 Zahl, 1 Sonderzeichen
|
||||
return (bool) preg_match(
|
||||
'/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).{8,}$/',
|
||||
$password
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check password strength (2/2)
|
||||
* @param string $password password to check
|
||||
@@ -41,7 +24,10 @@ function checkPasswordStrength(string $password): bool {
|
||||
//check if spec. chars
|
||||
if(preg_match('/[^a-zA-Z0-9]/', $password)) $strength++;
|
||||
|
||||
// valid password: #Test12345
|
||||
return($strength >= 5);
|
||||
|
||||
}
|
||||
|
||||
function isValidEmail(string $email):bool {
|
||||
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
|
||||
}
|
||||
Reference in New Issue
Block a user