Adjustments to the regex

I made the regex a bit less restrictive. If you want, you can push this if it seems appropriate.

Username should be at least 4 characters and max 32
Password should be at least 8 characters and max 32

Usernames can be any combination of letters and numbers, with no special characters except for dash and underscore.

Passwords can use any of the alphanumeric/special characters specified in the regex.
This commit is contained in:
SengokuNadeko 2020-09-06 11:27:53 -04:00 committed by CakeLancelot
parent 3876e0537e
commit 361c069d0c

View File

@ -398,8 +398,8 @@ bool CNLoginServer::exitDuplicate(int accountId)
} }
bool CNLoginServer::isLoginDataGood(std::string login, std::string password) bool CNLoginServer::isLoginDataGood(std::string login, std::string password)
{ {
std::regex loginRegex("^(?=.*[A-Za-z0-9]$)[A-Za-z][A-Za-z\d.-]{3,20}$"); std::regex loginRegex("[a-zA-Z0-9_-]{4,32}");
std::regex passwordRegex("^(?=.*[A-Za-z0-9]$)[A-Za-z][A-Za-z\d.-]{3,20}$"); std::regex passwordRegex("[a-zA-Z0-9!@#$%^&*()_+]{8,32}");
return (std::regex_match(login, loginRegex) && std::regex_match(password, passwordRegex)); return (std::regex_match(login, loginRegex) && std::regex_match(password, passwordRegex));
} }
bool CNLoginServer::isPasswordCorrect(std::string actualPassword, std::string tryPassword) bool CNLoginServer::isPasswordCorrect(std::string actualPassword, std::string tryPassword)