summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorubq323 <ubq323>2021-06-20 11:24:31 +0000
committerubq323 <ubq323>2021-06-20 11:24:31 +0000
commit3be75ab10340ec76f6f65bd6256f7ecb1d1adc1c (patch)
tree613dc4fa30cd58237ec08ac1d8236aa7729af751
parentb1780ca83b786eea64e8bc15b89284509485d0e4 (diff)
maximum username length
-rw-r--r--apioforum/auth.py2
1 files changed, 2 insertions, 0 deletions
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(