add: function that checks if username is valid

pull/912/head
Antonia Koch 2024-05-02 13:27:03 +02:00 committed by GitHub
parent 10f0adb7a5
commit db0a11185a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -49,6 +49,8 @@ def load_user_from_request(request: Request) -> User | None:
return user return user
return None return None
def valid_username(username: str) -> bool:
return re.match("^[A-Za-z0-9]+$", username)
@lru_cache(64) @lru_cache(64)
def build_keys_table() -> dict[str, str]: def build_keys_table() -> dict[str, str]: