mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-26 15:00:06 +00:00
Allow period and numbers in firstname/lastname regex check (#144)
* Remove unnecessary whitespace check in regex * Allow dot characters in names (except at the beginning of a name) * Allow numbers in names
This commit is contained in:
parent
d505b09e98
commit
5293573116
@ -438,8 +438,9 @@ bool CNLoginServer::isPasswordCorrect(std::string actualPassword, std::string tr
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CNLoginServer::isCharacterNameGood(std::string Firstname, std::string Lastname) {
|
bool CNLoginServer::isCharacterNameGood(std::string Firstname, std::string Lastname) {
|
||||||
std::regex firstnamecheck("[a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*$");
|
//Allow alphanumeric and dot characters in names(disallows dot and space characters at the beginning of a name)
|
||||||
std::regex lastnamecheck("[a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*$");
|
std::regex firstnamecheck(R"(((?! )(?!\.)[a-zA-Z0-9]*\.{0,1}(?!\.+ +)[a-zA-Z0-9]* {0,1}(?! +))*$)");
|
||||||
|
std::regex lastnamecheck(R"(((?! )(?!\.)[a-zA-Z0-9]*\.{0,1}(?!\.+ +)[a-zA-Z0-9]* {0,1}(?! +))*$)");
|
||||||
return (std::regex_match(Firstname, firstnamecheck) && std::regex_match(Lastname, lastnamecheck));
|
return (std::regex_match(Firstname, firstnamecheck) && std::regex_match(Lastname, lastnamecheck));
|
||||||
}
|
}
|
||||||
#pragma endregion helperMethods
|
#pragma endregion helperMethods
|
||||||
|
Loading…
Reference in New Issue
Block a user