Allows users to hide their check-ins from other users

This commit is contained in:
Peter Stockings
2026-02-24 13:17:09 +11:00
parent d6885a8339
commit c21a7890f3
9 changed files with 267 additions and 51 deletions

View File

@@ -16,6 +16,7 @@ def signup():
gender = request.form.get("gender") or None
goal_weight_kg = request.form.get("goal_weight_kg") or None
starting_weight_kg = request.form.get("starting_weight_kg") or None
is_private = request.form.get("is_private") == "on"
# Validation
if not username or not password:
@@ -35,9 +36,9 @@ def signup():
# Create user
password_hash = generate_password_hash(password)
user = execute_returning(
"""INSERT INTO users (username, password_hash, display_name, height_cm, age, gender, goal_weight_kg, starting_weight_kg)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING id""",
(username, password_hash, display_name or username, height_cm, age, gender, goal_weight_kg, starting_weight_kg),
"""INSERT INTO users (username, password_hash, display_name, height_cm, age, gender, goal_weight_kg, starting_weight_kg, is_private)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING id""",
(username, password_hash, display_name or username, height_cm, age, gender, goal_weight_kg, starting_weight_kg, is_private),
)
session["user_id"] = user["id"]