diff --git a/src/user_filter.cpp b/src/user_filter.cpp index d007bfa..4e66fb5 100644 --- a/src/user_filter.cpp +++ b/src/user_filter.cpp @@ -1,5 +1,21 @@ #include "user_filter.h" +__attribute__((always_inline)) inline bool ValidUsername(const std::string &name) noexcept +{ + if (name.size() < min_name_size || name.size() > max_name_size) + { + return false; + } + for (char c : name) + { + if (!((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_')) + { + return false; + } + } + return true; +} + template UserFilter::UserFilter(Bank &b) : bank(b) {}