fix achievements not shown in in profile and also make profile dark mode

This commit is contained in:
csd4ni3l
2025-08-15 16:57:33 +02:00
parent eef9e5eef1
commit d66290d935
2 changed files with 14 additions and 12 deletions

View File

@@ -272,7 +272,7 @@ def profile():
grass_touching_count, last_grass_touch_time = row
return render_template("profile.jinja2", username=username, grass_touching_count=grass_touching_count, last_grass_touch_time=float(last_grass_touch_time), now=time.time(), your_account=True)
return render_template("profile.jinja2", username=username, grass_touching_count=grass_touching_count, last_grass_touch_time=float(last_grass_touch_time), now=time.time(), achievements=ACHIEVEMENTS, your_account=True)
@app.route("/profile/<username>")
def public_profile(username):
@@ -289,7 +289,7 @@ def public_profile(username):
grass_touching_count, last_grass_touch_time = row
return render_template("profile.jinja2", username=username, grass_touching_count=grass_touching_count, last_grass_touch_time=float(last_grass_touch_time), now=time.time(), your_account=False)
return render_template("profile.jinja2", username=username, grass_touching_count=grass_touching_count, last_grass_touch_time=float(last_grass_touch_time), now=time.time(), achievements=ACHIEVEMENTS, your_account=False)
@app.route("/login", methods=["GET", "POST"])
def login():

View File

@@ -2,6 +2,7 @@
{% block title %}Grass Touching Profile{% endblock %}
{% block body %}
<body class="bg-dark text-light">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid d-flex justify-content-center">
<a class="navbar-brand" href="/">Grass Touching Captcha</a>
@@ -26,7 +27,7 @@
</nav>
<div class="container my-4">
<div class="card shadow-sm">
<div class="card shadow-sm bg-dark text-light border-secondary">
<div class="card-body">
<h2 class="card-title">Profile Overview{% if not your_account%} of {{ username}} {% endif %}</h2>
@@ -39,7 +40,7 @@
</div>
</div>
<div class="card shadow-sm">
<div class="card shadow-sm bg-dark text-light border-secondary mt-4">
<div class="card-body">
<h2 class="card-title">Achievements{% if not your_account%} of {{ username}} {% endif %}</h2>
@@ -47,7 +48,7 @@
{% for achievement in achievements %}
{% set unlocked = grass_touching_count >= achievement[0] %}
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="card h-100 {% if unlocked %}border-success shadow{% else %}border-secondary text-muted{% endif %}">
<div class="card h-100 {% if unlocked %}border-success shadow{% else %}border-secondary text-muted{% endif %} bg-dark">
<div class="card-body">
<h5 class="card-title">
{% if unlocked %}
@@ -69,41 +70,41 @@
</div>
{% if your_account %}
<div class="card shadow-sm mt-4">
<div class="card shadow-sm mt-4 bg-dark text-light border-secondary">
<div class="card-body">
<h4>Change Username</h4>
<form method="POST" action="/change_username">
<div class="mb-3">
<label for="newUsername" class="form-label">New Username</label>
<input type="text" class="form-control" id="newUsername" name="new_username" placeholder="Enter new username" required>
<input type="text" class="form-control bg-secondary text-light" id="newUsername" name="new_username" placeholder="Enter new username" required>
</div>
<button type="submit" class="btn btn-primary">Update Username</button>
</form>
</div>
</div>
<div class="card shadow-sm mt-4">
<div class="card shadow-sm mt-4 bg-dark text-light border-secondary">
<div class="card-body">
<h4>Change Password</h4>
<form method="POST" action="/change_password">
<div class="mb-3">
<label for="currentPassword" class="form-label">Current Password</label>
<input type="password" class="form-control" id="currentPassword" name="current_password" placeholder="Enter current password" required>
<input type="password" class="form-control bg-secondary text-light" id="currentPassword" name="current_password" placeholder="Enter current password" required>
</div>
<div class="mb-3">
<label for="newPassword" class="form-label">New Password</label>
<input type="password" class="form-control" id="newPassword" name="new_password" placeholder="Enter new password" required>
<input type="password" class="form-control bg-secondary text-light" id="newPassword" name="new_password" placeholder="Enter new password" required>
</div>
<div class="mb-3">
<label for="confirmPassword" class="form-label">Confirm New Password</label>
<input type="password" class="form-control" id="confirmPassword" name="confirm_password" placeholder="Re-enter new password" required>
<input type="password" class="form-control bg-secondary text-light" id="confirmPassword" name="confirm_password" placeholder="Re-enter new password" required>
</div>
<button type="submit" class="btn btn-primary">Update Password</button>
</form>
</div>
</div>
<div class="card shadow-sm mt-4 border-danger">
<div class="card shadow-sm mt-4 border-danger bg-dark text-light">
<div class="card-body">
<h4 class="text-danger">Danger Zone</h4>
<p class="text-muted">These actions cannot be undone!</p>
@@ -121,4 +122,5 @@
</div>
{% endif %}
</div>
</body>
{% endblock %}