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