summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstilbruch <stilbruch@protonail.com>2022-04-04 17:44:12 -0500
committerstilbruch <stilbruch@protonail.com>2022-04-04 17:44:12 -0500
commita981d059304e2cab36cf694b09334245ce855d12 (patch)
tree325538d6785da614cef68110defb3eaa60f48e11
parent5d74e9e1bb30e65dbd4d0528f7140b7813965841 (diff)
downloadStrengthy-a981d059304e2cab36cf694b09334245ce855d12.tar.xz
Strengthy-a981d059304e2cab36cf694b09334245ce855d12.zip
Improve "login_required"
-rw-r--r--app/app.py1
-rw-r--r--app/routes.py1
-rw-r--r--app/templates/base/form.html10
3 files changed, 9 insertions, 3 deletions
diff --git a/app/app.py b/app/app.py
index 3051934..4ce3c61 100644
--- a/app/app.py
+++ b/app/app.py
@@ -12,6 +12,7 @@ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# Setup flask-login
login_manager = LoginManager(app)
login_manager.init_app(app)
+login_manager.login_view = "/login"
# Setup SQLAlchemy
# https://flask-sqlalchemy.palletsprojects.com/en/2.x/quickstart/#a-minimal-application
diff --git a/app/routes.py b/app/routes.py
index ce47d83..336218c 100644
--- a/app/routes.py
+++ b/app/routes.py
@@ -60,6 +60,7 @@ def register():
return render_template('user/register.html', form=form)
@app.route("/workout/create", methods=['GET', 'POST'])
+@login_required
def createWorkout():
form = RegisterForm()
return render_template('workout/create.html', form=form)
diff --git a/app/templates/base/form.html b/app/templates/base/form.html
index 440ea0e..8423a0c 100644
--- a/app/templates/base/form.html
+++ b/app/templates/base/form.html
@@ -13,9 +13,13 @@
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
- <div class="notification is-{{ category }}">
- {{ message }}
- </div>
+ {% if category == "message" %}
+ <div class="notification is-info">
+ {% else %}
+ <div class="notification is-{{ category }}">
+ {% endif %}
+ {{ message }}
+ </div>
{% endfor %}
{% endif %}
{% endwith %}