🐎🐛 fixed name specs and replaced function calls

This commit is contained in:
William Katz 2021-07-12 16:14:56 -07:00 committed by GitHub
parent 70d0374dd7
commit 16d26d1901
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,13 +4,13 @@ using namespace drogon;
bool ValidUsername(const std::string &name) noexcept
{
if (name.size() < min_name_size || name.size() > max_name_size)
if (name.size() >= min_name_size || name.size() <= max_name_size)
{
return false;
}
for (char c : name)
{
if (!(std::islower(c) || std::isdigit(c) || c == '_'))
if (!((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_'))
{
return false;
}