From 4bc319c32a292767c472a60727ed06489eac4278 Mon Sep 17 00:00:00 2001 From: Stef Date: Thu, 21 Aug 2025 17:05:32 +0200 Subject: [PATCH 1/3] Revert "Update requirements.txt" This reverts commit 24a1757166da094444451a7f810ceb992834a717. --- requirements.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index dc8b927..f143bf2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,3 @@ -# For Python >=3.8, importlib-metadata backport is not needed -python_version >= "3.12.10" - -# Package requirements alembic==1.16.4 blinker==1.9.0 click==8.2.1 From 573437f4cf0897ed25f0ef7108c9ed98953c6d7d Mon Sep 17 00:00:00 2001 From: Stef <48526421+StefBuwalda@users.noreply.github.com> Date: Wed, 8 Oct 2025 11:56:20 +0200 Subject: [PATCH 2/3] Adjusted GUI of daily dashboard to better deal with float values (#9) --- application/user/templates/daily_log.html | 28 ++++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/application/user/templates/daily_log.html b/application/user/templates/daily_log.html index 71bf00a..9fd6017 100644 --- a/application/user/templates/daily_log.html +++ b/application/user/templates/daily_log.html @@ -11,14 +11,14 @@
Macros
{% for macro in macros %}
- {{ macro.name }}: {{ macro.current }} / {{ macro.target }} + {{ macro.name }}: {{ macro.current | int }} / {{ macro.target }}
- {{ (macro.current - macro.target) }}{{ macro.unit }} + {{ (macro.current - macro.target) | int}}{{ macro.unit }}
- {{ min(macro.current, macro.target) }}{{ macro.unit }} + {{ min(macro.current, macro.target) | int }}{{ macro.unit }}
@@ -30,15 +30,31 @@
Items Eaten Today
{% for log in logs %} -
- ({{ log.amount }}g) {{ log.food_item.name }} - {{ log.food_item.energy_100 * log.amount / 100 }} kcal +
+ + + ({{ log.amount | int }}g) + + + + + {{ log.food_item.name }} + + + + + {{ (log.food_item.energy_100 * log.amount / 100) | int }} kcal +
{% endfor %}
+ + + From 88f553a08e5b0d29bcfb3cfac96a568c0b448160 Mon Sep 17 00:00:00 2001 From: Stef <48526421+StefBuwalda@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:38:40 +0200 Subject: [PATCH 3/3] New webpage structure, not yet finished. Change password implemented again (#11) * Adjusted GUI of daily dashboard to better deal with float values * Change password + New base (#10) * created a new Base template to test with * Changed out the base and added a new password page * Password change works, UI needs redisgn --- app.py | 12 ++-- application/auth/routes.py | 7 +- .../auth/templates/new_change_password.html | 52 ++++++++++++++ application/templates/base.html | 72 ++----------------- application/templates/flash.html | 9 +++ application/templates/navbar.html | 51 +++++++++++++ application/templates/new_navbar.html | 60 ++++++++++++++++ 7 files changed, 190 insertions(+), 73 deletions(-) create mode 100644 application/auth/templates/new_change_password.html create mode 100644 application/templates/flash.html create mode 100644 application/templates/navbar.html create mode 100644 application/templates/new_navbar.html diff --git a/app.py b/app.py index 8659ea8..b623d38 100644 --- a/app.py +++ b/app.py @@ -1,8 +1,4 @@ -from flask import ( - redirect, - url_for, - send_from_directory, -) +from flask import redirect, url_for, send_from_directory, render_template from flask_login import ( login_required, current_user, @@ -54,6 +50,12 @@ def index(): return redirect(url_for("auth.login")) +@app.route("/test") +@login_required +def text(): + return render_template("newBase.html") + + @app.route("/favicon.ico") def favicon(): return send_from_directory("static", "favicon.ico") diff --git a/application/auth/routes.py b/application/auth/routes.py index b14c3f9..10314ce 100644 --- a/application/auth/routes.py +++ b/application/auth/routes.py @@ -35,8 +35,8 @@ def login(): return render_template("login.html", form=form) -@bp.route("/change_password", methods=["GET", "POST"]) -def change_password(): +@bp.route("/change_pass", methods=["GET", "POST"]) +def change_pass(): if not current_user.is_authenticated: return redirect(url_for("auth.login")) @@ -50,8 +50,9 @@ def change_password(): current_user.change_password(form.new_password.data) current_user.set_pw_change(False) db.session.commit() + logout_user() return default_return() - return render_template("change_password.html", form=form) + return render_template("new_change_password.html", form=form) @bp.route("/logout") diff --git a/application/auth/templates/new_change_password.html b/application/auth/templates/new_change_password.html new file mode 100644 index 0000000..e9ffbe2 --- /dev/null +++ b/application/auth/templates/new_change_password.html @@ -0,0 +1,52 @@ +{% extends "base.html" %} + +{% block title %}Change Password{%endblock%} + +{% block content %} + + +
+
+

Change Your Password

+
+ {{ form.hidden_tag() }} +
+ + {{ form.current_password(class="form-control", placeholder="") }} + {% if form.current_password.errors %} +
+ {{ form.current_password.errors[0] }} +
+ {% endif %} +
+
+ + {{ form.new_password(class="form-control", placeholder="Enter password") }} + {% if form.new_password.errors %} +
+ {{ form.new_password.errors[0] }} +
+ {% endif %} +
+
+ + {{ form.confirm_password(class="form-control", placeholder="Enter password") }} + {% if form.confirm_password.errors %} +
+ {{ form.confirm_password.errors[0] }} +
+ {% endif %} +
+ {{ form.submit(class="btn btn-primary w-100", label="Update Password") }} +
+

+ Make sure your password is at least 8 characters long and includes a mix of letters and numbers. +

+
+
+{% endblock %} \ No newline at end of file diff --git a/application/templates/base.html b/application/templates/base.html index 4f1e0fb..e744566 100644 --- a/application/templates/base.html +++ b/application/templates/base.html @@ -10,74 +10,16 @@ - - + {% include "flash.html" %} + {% block content %} + {% endblock %} -
- {% with messages = get_flashed_messages() %} - {% if messages %} -
- {% for message in messages %} -

{{ message }}

- {% endfor %} -
- {% endif %} - {% endwith %} - - {% block content %} - {% endblock %} -
- - + {% block footer %} + {% endblock %} diff --git a/application/templates/flash.html b/application/templates/flash.html new file mode 100644 index 0000000..fc52cf1 --- /dev/null +++ b/application/templates/flash.html @@ -0,0 +1,9 @@ +{% with messages = get_flashed_messages() %} +{% if messages %} +
+ {% for message in messages %} +

{{ message }}

+ {% endfor %} +
+{% endif %} +{% endwith %} \ No newline at end of file diff --git a/application/templates/navbar.html b/application/templates/navbar.html new file mode 100644 index 0000000..58625d2 --- /dev/null +++ b/application/templates/navbar.html @@ -0,0 +1,51 @@ + + + \ No newline at end of file diff --git a/application/templates/new_navbar.html b/application/templates/new_navbar.html new file mode 100644 index 0000000..7733e8a --- /dev/null +++ b/application/templates/new_navbar.html @@ -0,0 +1,60 @@ + + + + \ No newline at end of file