improved html and some other stuff like the prefered age range and also added likes and dislikes
This commit is contained in:
parent
82b526b512
commit
e9d2569c1e
6 changed files with 148 additions and 40 deletions
34
src/main.py
34
src/main.py
|
|
@ -128,9 +128,39 @@ def register():
|
||||||
# collect data to a dictionary
|
# collect data to a dictionary
|
||||||
data = {key: request.form.get(key) for key in [
|
data = {key: request.form.get(key) for key in [
|
||||||
"username","pgp","firstname","lastname","sex","date_of_birth","country","xmpp",
|
"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
|
||||||
required_fields = ["username","pgp","firstname","lastname","sex","date_of_birth","country","xmpp"]
|
required_fields = ["username","pgp","firstname","lastname","sex","date_of_birth","country","xmpp"]
|
||||||
if not all(data[f] for f in required_fields):
|
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,
|
height=float(data["height"]) if data.get("height") else None,
|
||||||
weight=int(data["weight"]) if data.get("weight") else None,
|
weight=int(data["weight"]) if data.get("weight") else None,
|
||||||
race=data.get("race") or 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,
|
prefered_age_range=data.get("prefered_age_range") or None,
|
||||||
is_verified=True
|
is_verified=True
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'font';
|
font-family: 'font';
|
||||||
src: url('/font/font.ttf') format('truetype');
|
src: url('/static/font/font.ttf') format('truetype');
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'font';
|
font-family: 'font';
|
||||||
src: url('/font/font-Bold.ttf') format('truetype');
|
src: url('/static/font/font-Bold.ttf') format('truetype');
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,34 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Login</h2>
|
<h2>Login</h2>
|
||||||
<p>Enter your username and PGP public key to receive a challenge.</p>
|
<p>Enter your username and PGP public key to receive a verification challenge.</p>
|
||||||
|
|
||||||
<form method="POST" action="{{ url_for('login') }}">
|
<form method="POST" action="{{ url_for('login') }}">
|
||||||
<label>Username:</label><br>
|
|
||||||
<input type="text" name="username" required><br><br>
|
|
||||||
|
|
||||||
<label>PGP Public Key:</label><br>
|
<fieldset>
|
||||||
<textarea name="pgp" rows="8" cols="60" required></textarea><br><br>
|
<legend>Account Verification</legend>
|
||||||
|
|
||||||
<button type="submit">Send Challenge</button>
|
<label for="username">Username</label><br>
|
||||||
|
<input type="text" id="username" name="username" required><br><br>
|
||||||
|
|
||||||
|
<label for="pgp">PGP Public Key</label><br>
|
||||||
|
<textarea id="pgp" name="pgp" rows="8" required></textarea><br>
|
||||||
|
<small>Paste your full public key block</small>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<button type="submit">Send Challenge</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- Flash messages -->
|
||||||
|
{% with messages = get_flashed_messages() %}
|
||||||
|
{% if messages %}
|
||||||
|
<ul>
|
||||||
|
{% for message in messages %}
|
||||||
|
<li style="color:red;">{{ message }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -4,61 +4,118 @@
|
||||||
<h2>Register</h2>
|
<h2>Register</h2>
|
||||||
|
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
<h3>Account (required)</h3>
|
|
||||||
<input type="text" name="username" placeholder="Username" required><br>
|
|
||||||
<textarea name="pgp" placeholder="PGP Public Key" required></textarea><br>
|
|
||||||
|
|
||||||
<h3>Personal Info (required)</h3>
|
<fieldset>
|
||||||
<input type="text" name="firstname" placeholder="First Name*" required><br>
|
<legend>Account (required)</legend>
|
||||||
<input type="text" name="lastname" placeholder="Last Name*" required><br>
|
|
||||||
|
|
||||||
<select name="sex" required>
|
<label for="username">Username</label><br>
|
||||||
|
<input type="text" id="username" name="username" required><br><br>
|
||||||
|
|
||||||
|
<label for="pgp">PGP Public Key</label><br>
|
||||||
|
<textarea id="pgp" name="pgp" rows="6" required></textarea>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Personal Info (required)</legend>
|
||||||
|
|
||||||
|
<label for="firstname">First Name</label><br>
|
||||||
|
<input type="text" id="firstname" name="firstname" required><br><br>
|
||||||
|
|
||||||
|
<label for="lastname">Last Name</label><br>
|
||||||
|
<input type="text" id="lastname" name="lastname" required><br><br>
|
||||||
|
|
||||||
|
<label for="sex">Sex</label><br>
|
||||||
|
<select id="sex" name="sex" required>
|
||||||
<option value="">Select Sex</option>
|
<option value="">Select Sex</option>
|
||||||
<option value="male">Male</option>
|
<option value="male">Male</option>
|
||||||
<option value="female">Female</option>
|
<option value="female">Female</option>
|
||||||
</select><br>
|
</select><br><br>
|
||||||
|
|
||||||
<input type="date" name="date_of_birth" required><br>
|
<label for="date_of_birth">Date of Birth</label><br>
|
||||||
|
<input type="date" id="date_of_birth" name="date_of_birth" required>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<h3>Profile Picture (required)</h3>
|
<fieldset>
|
||||||
<input type="file" name="profile_picture" accept="image/*" required><br>
|
<legend>Pictures</legend>
|
||||||
|
|
||||||
<h3>Other Pictures (optional, multiple)</h3>
|
<label for="profile_picture">Profile Picture (required)</label><br>
|
||||||
<input type="file" name="pictures" accept="image/*" multiple><br>
|
<input type="file" id="profile_picture" name="profile_picture" accept="image/*" required><br><br>
|
||||||
|
|
||||||
<h3>Country (required)</h3>
|
<label for="pictures">Other Pictures (optional)</label><br>
|
||||||
<select name="country" required>
|
<input type="file" id="pictures" name="pictures" accept="image/*" multiple>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Location</legend>
|
||||||
|
|
||||||
|
<label for="country">Country</label><br>
|
||||||
|
<select id="country" name="country" required>
|
||||||
<option value="">Select Country</option>
|
<option value="">Select Country</option>
|
||||||
{% for c in countries %}
|
{% for c in countries %}
|
||||||
<option value="{{ c }}">{{ c }}</option>
|
<option value="{{ c }}">{{ c }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select><br>
|
</select><br><br>
|
||||||
|
|
||||||
<h3>City (optional)</h3>
|
<label for="city">City</label><br>
|
||||||
<input type="text" name="city" placeholder="City"><br>
|
<input type="text" id="city" name="city">
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<h3>Physical Attributes (optional)</h3>
|
<fieldset>
|
||||||
<input type="number" step="0.01" name="height" placeholder="Height (m)"><br>
|
<legend>Physical Attributes</legend>
|
||||||
<input type="number" name="weight" placeholder="Weight (kg)"><br>
|
|
||||||
<select name="race" required>
|
<label for="height">Height (meters)</label><br>
|
||||||
<option value="">select race</option>
|
<input type="number" step="0.01" id="height" name="height"><br><br>
|
||||||
|
|
||||||
|
<label for="weight">Weight (kg)</label><br>
|
||||||
|
<input type="number" id="weight" name="weight"><br><br>
|
||||||
|
|
||||||
|
<label for="race">Race</label><br>
|
||||||
|
<select id="race" name="race">
|
||||||
|
<option value="">Select race</option>
|
||||||
<option value="Latino(a)">Latino</option>
|
<option value="Latino(a)">Latino</option>
|
||||||
<option value="Asian">Asian</option>
|
<option value="Asian">Asian</option>
|
||||||
<option value="White">White</option>
|
<option value="White">White</option>
|
||||||
<option value="Black">Black</option>
|
<option value="Black">Black</option>
|
||||||
<option value="Brown">Brown</option>
|
<option value="Brown">Brown</option>
|
||||||
<option value="Native American">Native American</option>
|
<option value="Native American">Native American</option>
|
||||||
</select><br>
|
</select>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<h3>Preferences (optional)</h3>
|
<fieldset>
|
||||||
<input type="text" name="prefered_age_range" placeholder="Preferred Age Range"><br>
|
<legend>Preferences</legend>
|
||||||
|
|
||||||
<h3>Contacts (required)</h3>
|
<label>Preferred Age Range</label><br>
|
||||||
<input type="text" name="xmpp" placeholder="XMPP" required><br>
|
|
||||||
<input type="email" name="email" placeholder="Email"><br>
|
|
||||||
<input type="text" name="phone" placeholder="Phone"><br><br>
|
|
||||||
|
|
||||||
<button type="submit">Register</button>
|
<label for="preferred_age_min">Minimum Age</label><br>
|
||||||
|
<input type="number" id="preferred_age_min" name="preferred_age_min" min="18" max="120"><br>
|
||||||
|
|
||||||
|
<label for="preferred_age_max">Maximum Age</label><br>
|
||||||
|
<input type="number" id="preferred_age_max" name="preferred_age_max" min="18" max="120"><br>
|
||||||
|
|
||||||
|
<label for="likes">Things You Like</label><br>
|
||||||
|
<input type="text" id="likes" name="likes" placeholder="music, travel, coding"><br>
|
||||||
|
<small>Separate with commas</small><br><br>
|
||||||
|
|
||||||
|
<label for="dislikes">Things You Don't Like</label><br>
|
||||||
|
<input type="text" id="dislikes" name="dislikes" placeholder="smoking, drama"><br>
|
||||||
|
<small>Separate with commas</small>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Contacts (required)</legend>
|
||||||
|
|
||||||
|
<label for="xmpp">XMPP</label><br>
|
||||||
|
<input type="text" id="xmpp" name="xmpp" required><br><br>
|
||||||
|
|
||||||
|
<label for="email">Email</label><br>
|
||||||
|
<input type="email" id="email" name="email"><br><br>
|
||||||
|
|
||||||
|
<label for="phone">Phone</label><br>
|
||||||
|
<input type="text" id="phone" name="phone">
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<button type="submit">Register</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% with messages = get_flashed_messages() %}
|
{% with messages = get_flashed_messages() %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue