diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-05-14 01:27:08 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-05-14 01:27:08 +0100 |
commit | e2341aafd9dce39bac453be371c834ddee0fb747 (patch) | |
tree | 8913be3ae98aa8316f8e4907aa5ca5cae8a82774 | |
parent | d2b705b8bb280d7c8951903b80a9f95993841315 (diff) | |
download | cheatdb-e2341aafd9dce39bac453be371c834ddee0fb747.tar.xz |
Fix crash on anonymous user in rank_required
-rw-r--r-- | app/views/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/views/utils.py b/app/views/utils.py index f6e345a..44647a1 100644 --- a/app/views/utils.py +++ b/app/views/utils.py @@ -1,4 +1,4 @@ -from flask import request, flash, abort +from flask import request, flash, abort, redirect from flask_user import * from flask_login import login_user, logout_user from app.models import * @@ -84,6 +84,8 @@ def rank_required(rank): def decorator(f): @wraps(f) def decorated_function(*args, **kwargs): + if not current_user.is_authenticated: + return redirect(url_for("user.login")) if not current_user.rank.atLeast(rank): abort(403) |