mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-19 01:22:14 +11:00
🐎 inlined ValidUsername()
This commit is contained in:
parent
a65224d39e
commit
6e8b3357c9
1 changed files with 16 additions and 0 deletions
|
|
@ -1,5 +1,21 @@
|
||||||
#include "user_filter.h"
|
#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 <bool set_body_flag, bool require_admin>
|
template <bool set_body_flag, bool require_admin>
|
||||||
UserFilter<set_body_flag, require_admin>::UserFilter(Bank &b) : bank(b) {}
|
UserFilter<set_body_flag, require_admin>::UserFilter(Bank &b) : bank(b) {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue