master
Aevann1 2021-08-03 19:28:36 +02:00
parent db49836ed9
commit bfba41dd07
1 changed files with 4 additions and 23 deletions

View File

@ -87,15 +87,9 @@ def check_ban_evade(v):
# Wrappers
def auth_desired(f):
# decorator for any view that changes if user is logged in (most pages)
def wrapper(*args, **kwargs):
v, c = get_logged_in_user()
if c:
kwargs["c"] = c
v = get_logged_in_user()
check_ban_evade(v)
resp = make_response(f(*args, v=v, **kwargs))
@ -110,18 +104,13 @@ def auth_required(f):
def wrapper(*args, **kwargs):
v, c = get_logged_in_user()
#print(v, c)
v = get_logged_in_user()
if not v:
abort(401)
check_ban_evade(v)
if c:
kwargs["c"] = c
g.v = v
# an ugly hack to make api work
@ -137,9 +126,7 @@ def is_not_banned(f):
def wrapper(*args, **kwargs):
v, c = get_logged_in_user()
#print(v, c)
v = get_logged_in_user()
if not v:
abort(401)
@ -149,9 +136,6 @@ def is_not_banned(f):
if v.is_suspended:
abort(403)
if c:
kwargs["c"] = c
g.v = v
resp = make_response(f(*args, v=v, **kwargs))
@ -168,10 +152,7 @@ def admin_level_required(x):
def wrapper(*args, **kwargs):
v, c = get_logged_in_user()
if c:
return {"error": "No admin api access"}, 403
v = get_logged_in_user()
if not v:
abort(401)