You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
281 B
13 lines
281 B
2 years ago
|
from functools import wraps
|
||
|
from flask import g, redirect, url_for
|
||
|
|
||
|
|
||
|
def login_required(func):
|
||
|
@wraps(func)
|
||
|
def inner(*args, **kwargs):
|
||
|
if g.user:
|
||
|
return func(*args, **kwargs)
|
||
|
else:
|
||
|
return redirect(url_for('login'))
|
||
|
return inner
|