From 4284137ccfa451bd36eb9e7a02db9252315bf20a Mon Sep 17 00:00:00 2001 From: citrons Date: Sun, 20 Jun 2021 17:47:18 +0000 Subject: usernames must be alphanumeric; set html maxlength for username box to improve UX™ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apioforum/auth.py | 2 ++ apioforum/templates/auth/register.html | 2 +- apioforum/templates/user_settings.html | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apioforum/auth.py b/apioforum/auth.py index d5f2652..deacfc8 100644 --- a/apioforum/auth.py +++ b/apioforum/auth.py @@ -56,6 +56,8 @@ def register(): err = f"User {username} is already registered." elif len(username) > 20: err = "username can't be longer than 20 characters" + elif not username.isalnum(): + err = "username must be alphanumeric" if err is None: db.execute( diff --git a/apioforum/templates/auth/register.html b/apioforum/templates/auth/register.html index 7d079c2..5d27b90 100644 --- a/apioforum/templates/auth/register.html +++ b/apioforum/templates/auth/register.html @@ -7,7 +7,7 @@

create a new account here. if you already have an account, login instead.

- +
diff --git a/apioforum/templates/user_settings.html b/apioforum/templates/user_settings.html index cac613a..d463eee 100644 --- a/apioforum/templates/user_settings.html +++ b/apioforum/templates/user_settings.html @@ -5,9 +5,9 @@
change password -
+
- +
change bio -- cgit v1.2.3