aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJJ <nicetry@noemail.com>2025-04-01 09:44:32 +0100
committerJJ <nicetry@noemail.com>2025-04-01 09:44:32 +0100
commit9aa6bcd67544d1172f0e930a9877ebbf4e436eed (patch)
treec292b7701a44d5f6a8e13627134385d4b38da380
parent0e1aed7fa7619be98e42b1f0b97ebc2ccc0f76ab (diff)
testing hook
-rw-r--r--.Constants.py.swpbin12288 -> 0 bytes
-rw-r--r--scripts/users/handle_users.py5
-rw-r--r--server.py3
3 files changed, 5 insertions, 3 deletions
diff --git a/.Constants.py.swp b/.Constants.py.swp
deleted file mode 100644
index ffb1f96..0000000
--- a/.Constants.py.swp
+++ /dev/null
Binary files differ
diff --git a/scripts/users/handle_users.py b/scripts/users/handle_users.py
index 7a315f1..e2fb7af 100644
--- a/scripts/users/handle_users.py
+++ b/scripts/users/handle_users.py
@@ -3,11 +3,12 @@ mongo_collection = mongo_database.get_collection("users")
def user_exists(user):
try:
- res = mongo_collection.find_one({"name": user}, {"password": 1})
+ res = mongo_collection.find_one({"name": user}, {"password": 1, "isAiSubscriber": 1})
if res is None:
return {"success": True, "user": None}
else:
- return {"success": True, "user": user, "password": res["password"]}
+ # Fix this - there is a better way
+ return {"success": True, "user": user, "password": res["password"], "isAiSubscriber": res["isAiSubscriber"]}
except:
return {"success": False, "error": "Request error, try again"}
diff --git a/server.py b/server.py
index 66c2d43..b6de869 100644
--- a/server.py
+++ b/server.py
@@ -126,6 +126,7 @@ def login_user():
pw_matches = bcrypt.check_password_hash(res["password"], pw)
if pw_matches:
session["username"] = user
+ session["isAiSubscriber"] = res["isAiSubscriber"]
return Response(headers={"HX-Redirect": "/home"})
else:
return "Incorrect password, try again"
@@ -186,7 +187,7 @@ def update_account():
session["isAiSubscriber"] = True
return Response(headers={"HX-Redirect": "/account"})
else:
- return f"<span class='error'>{response["message"]}</span>", 422
+ return f"<span class='error'>{response['message']}</span>", 422
if __name__ == "__main__":