form progress

This commit is contained in:
Xevion
2019-07-04 04:43:51 -05:00
parent 92a6f8ad49
commit d969cd5009
11 changed files with 91 additions and 24 deletions

14
app/custom.py Normal file
View File

@@ -0,0 +1,14 @@
from flask import abort
from flask_login import current_user
from functools import wraps
def require_role(roles=["User"]):
def wrap(func):
@wraps(func)
def decorated_view(*args, **kwargs):
if current_user.is_authenticated:
if current_user.has_roles(roles):
return func(*args, **kwargs)
return abort(401)
return decorated_view
return wrap