mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 14:32:25 +01:00
Fix crash on anonymous user in rank_required
This commit is contained in:
parent
d2b705b8bb
commit
e2341aafd9
@ -1,4 +1,4 @@
|
|||||||
from flask import request, flash, abort
|
from flask import request, flash, abort, redirect
|
||||||
from flask_user import *
|
from flask_user import *
|
||||||
from flask_login import login_user, logout_user
|
from flask_login import login_user, logout_user
|
||||||
from app.models import *
|
from app.models import *
|
||||||
@ -84,6 +84,8 @@ def rank_required(rank):
|
|||||||
def decorator(f):
|
def decorator(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def decorated_function(*args, **kwargs):
|
def decorated_function(*args, **kwargs):
|
||||||
|
if not current_user.is_authenticated:
|
||||||
|
return redirect(url_for("user.login"))
|
||||||
if not current_user.rank.atLeast(rank):
|
if not current_user.rank.atLeast(rank):
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user