From 3be75ab10340ec76f6f65bd6256f7ecb1d1adc1c Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 20 Jun 2021 11:24:31 +0000 Subject: maximum username length --- apioforum/auth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apioforum/auth.py b/apioforum/auth.py index 8a34700..d5f2652 100644 --- a/apioforum/auth.py +++ b/apioforum/auth.py @@ -54,6 +54,8 @@ def register(): "SELECT 1 FROM users WHERE username = ?;", (username,) ).fetchone() is not None: err = f"User {username} is already registered." + elif len(username) > 20: + err = "username can't be longer than 20 characters" if err is None: db.execute( -- cgit v1.2.3