aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrebecca <ubq323@ubq323.website>2026-10-30 23:38:12 +0000
committerrebecca <ubq323@ubq323.website>2026-10-30 23:38:12 +0000
commitccba971d6786379d334aa75beef3068b9db81c48 (patch)
treec936943143ffe101ca92c6dc8ed1069372fe6460
parente5ffd464edfaf5d1644bd20f0299d15674bde50d (diff)
auth: require advanced security question to prevent spam signups
-rw-r--r--apioforum/auth.py3
-rw-r--r--apioforum/templates/auth/register.html3
2 files changed, 6 insertions, 0 deletions
diff --git a/apioforum/auth.py b/apioforum/auth.py
index 93aafdd..8e939c0 100644
--- a/apioforum/auth.py
+++ b/apioforum/auth.py
@@ -47,6 +47,7 @@ def register():
if request.method == "POST":
username = request.form["username"]
password = request.form["password"]
+ whens_8am = request.form["whens_8am"]
db = get_db()
err = None
if not username:
@@ -61,6 +62,8 @@ def register():
err = "username can't be longer than 20 characters"
elif not username.isalnum():
err = "username must be alphanumeric"
+ elif whens_8am != "08:00":
+ err = "you need to enter 08:00 am, not any other time. this is a genuine spam prevention measure"
if err is None:
db.execute(
diff --git a/apioforum/templates/auth/register.html b/apioforum/templates/auth/register.html
index ed09c56..74c8c28 100644
--- a/apioforum/templates/auth/register.html
+++ b/apioforum/templates/auth/register.html
@@ -12,6 +12,9 @@
<label for="password">password</label>
<input type="password" name="password" id="password" required>
<br>
+ <input type="time" name="whens_8am" id="whens_8am">
+ <label for="whens_8am">when's 8am?</label>
+ <br><br>
<input type="checkbox" name="keep_logged_in" id="keep_logged_in">
<label for="keep_logged_in">keep me logged in</label>
<br>