From 8e2d2f5174ec8cff5c9754ece268764f6172af66 Mon Sep 17 00:00:00 2001 From: benjamyn Date: Wed, 26 Feb 2020 00:00:40 +1100 Subject: [PATCH 1/3] Did I break git>? --- templates/useracc.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 templates/useracc.html diff --git a/templates/useracc.html b/templates/useracc.html new file mode 100644 index 0000000..e69de29 From 1f8c406bd03ffdb0593abcb2431a4a2476b297b9 Mon Sep 17 00:00:00 2001 From: benjamyn Date: Wed, 26 Feb 2020 00:19:58 +1100 Subject: [PATCH 2/3] Added user management --- shop.py | 10 ++++++++-- templates/useracc.html | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/shop.py b/shop.py index c9266ae..9684625 100644 --- a/shop.py +++ b/shop.py @@ -73,7 +73,7 @@ def handle_data(): user_id = request.form['updatepass'] newpass = request.form['newpass'] db.update_pass(user_id, newpass) - return redirect(url_for("admin")) + return redirect(url_for("index")) if "logout" in request.form: session.clear() @@ -92,13 +92,18 @@ def handle_data(): return redirect(url_for('index')) +@application.route("/useracc") +def useracc(): + + return render_template("useracc.html") + @application.route("/admin") def admin(): if session.get('id') is None: data = {"title":"Login"} return render_template("auth.html", data=data) elif session.get('isAdmin') == 0: - return redirect(url_for("index")) + return redirect(url_for("useracc")) #get a list of users userList = db.get_users() @@ -110,3 +115,4 @@ def admin(): if __name__ == '__main__': db.doesTableExist() application.run(host="0.0.0.0") + diff --git a/templates/useracc.html b/templates/useracc.html index e69de29..f9efc89 100644 --- a/templates/useracc.html +++ b/templates/useracc.html @@ -0,0 +1,19 @@ +{% include "header.html" %} +
+ + +
+

Welcome {{session["username"].title()}} you can change your password below

+
+
+
+
+
+ +{% include "footer.html" %} \ No newline at end of file From 7d35f22bba9d92af6001ddeec13dd5a47f753b9e Mon Sep 17 00:00:00 2001 From: benjamyn Date: Wed, 26 Feb 2020 00:20:16 +1100 Subject: [PATCH 3/3] Swapped position of logout and admin --- templates/index.html | 86 ++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/templates/index.html b/templates/index.html index 279dc27..fb707db 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,49 +1,51 @@ {% include "header.html" %}
-
- -
+
+ +
+ + {% include "addForm.html" %} + +
+
+ {% include "list.html" %} +
-
- {% include "list.html" %} -
-
{% include "footer.html" %} \ No newline at end of file