Merge pull request #167 from ThomasRubini/password_conf

This commit is contained in:
Thomas Rubini 2023-01-27 12:11:34 +01:00 committed by GitHub
commit 15d26296f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,12 +70,15 @@ final class UserController
$S_email = Utils::getOrDie($A_postParams, "email");
$S_username = Utils::getOrDie($A_postParams, "username");
$S_password = Utils::getOrDie($A_postParams, "password");
$S_password_confirm = Utils::getOrDie($A_postParams, "password_confirm");
if (!filter_var($S_email, FILTER_VALIDATE_EMAIL)) {
$S_errmsg = "invalid email";
} else if( strlen($S_password) < 8 || strlen($S_password) > 150 ) {
$S_errmsg = "password must be between 8 and 150 characters";
} else if( $S_password !== $S_password_confirm) {
$S_errmsg = "password confirmation do not match";
} else if(UserModel::isEmailInDatabase($S_email)) {
$S_errmsg = "An user with this email is already registered";
}