first commit
This commit is contained in:
0
app/common/__init__.py
Normal file
0
app/common/__init__.py
Normal file
16
app/common/decorators.py
Normal file
16
app/common/decorators.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from flask_login import current_user
|
||||
from flask import abort
|
||||
|
||||
from functools import wraps
|
||||
|
||||
def login_required(f):
|
||||
@wraps(f)
|
||||
|
||||
def decorated_function(*args, **kwargs):
|
||||
if current_user.is_authenticated:
|
||||
pass
|
||||
else:
|
||||
abort(401)
|
||||
return f(*args, **kwargs)
|
||||
|
||||
return decorated_function
|
||||
Reference in New Issue
Block a user