diff --git a/src/main.py b/src/main.py index 32721d1..413e887 100644 --- a/src/main.py +++ b/src/main.py @@ -128,9 +128,39 @@ def register(): # collect data to a dictionary data = {key: request.form.get(key) for key in [ "username","pgp","firstname","lastname","sex","date_of_birth","country","xmpp", - "email","phone","city","height","weight","race","prefered_age_range" + "email","phone","city","height","weight","race" ]} + min_age = request.form.get("preferred_age_min") + max_age = request.form.get("preferred_age_max") + + if min_age and max_age: + try: + min_age = int(min_age) + max_age = int(max_age) + + if min_age < 18 or max_age < 18: + flash("Minimum age is 18.") + return redirect(url_for("register")) + + if min_age > max_age: + flash("Minimum age cannot be greater than maximum age.") + return redirect(url_for("register")) + + data["prefered_age_range"] = f"{min_age}-{max_age}" + + except ValueError: + flash("Invalid age range.") + return redirect(url_for("register")) + else: + data["prefered_age_range"] = None + + likes_raw = request.form.get("likes", "") + dislikes_raw = request.form.get("dislikes", "") + + data["likes"] = list(set(x.strip().lower() for x in likes_raw.split(",") if x.strip())) + data["dislikes"] = list(set(x.strip().lower() for x in dislikes_raw.split(",") if x.strip())) + # required fields required_fields = ["username","pgp","firstname","lastname","sex","date_of_birth","country","xmpp"] if not all(data[f] for f in required_fields): @@ -250,6 +280,8 @@ def verify(): height=float(data["height"]) if data.get("height") else None, weight=int(data["weight"]) if data.get("weight") else None, race=data.get("race") or None, + likes=data.get("likes") or [], + dislikes=data.get("dislikes") or [], prefered_age_range=data.get("prefered_age_range") or None, is_verified=True ) diff --git a/src/static/drip.css b/src/static/drip.css index 9f82005..e48c8aa 100644 --- a/src/static/drip.css +++ b/src/static/drip.css @@ -1,13 +1,13 @@ @font-face { font-family: 'font'; - src: url('/font/font.ttf') format('truetype'); + src: url('/static/font/font.ttf') format('truetype'); font-weight: normal; font-style: normal; font-display: swap; } @font-face { font-family: 'font'; - src: url('/font/font-Bold.ttf') format('truetype'); + src: url('/static/font/font-Bold.ttf') format('truetype'); font-weight: bold; font-style: normal; font-display: swap; diff --git a/src/font/font-Bold.ttf b/src/static/font/font-Bold.ttf similarity index 100% rename from src/font/font-Bold.ttf rename to src/static/font/font-Bold.ttf diff --git a/src/font/font.ttf b/src/static/font/font.ttf similarity index 100% rename from src/font/font.ttf rename to src/static/font/font.ttf diff --git a/src/templates/login.html b/src/templates/login.html index f0b5116..0fe3b7b 100644 --- a/src/templates/login.html +++ b/src/templates/login.html @@ -2,15 +2,34 @@ {% block content %}
Enter your username and PGP public key to receive a challenge.
+Enter your username and PGP public key to receive a verification challenge.
+ + +{% with messages = get_flashed_messages() %} + {% if messages %} +