suchwow/suchwow/utils/decorators.py

11 lines
No EOL
328 B
Python

from flask import session, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if "auth" not in session or not session["auth"]:
return redirect(url_for("auth.login"))
return f(*args, **kwargs)
return decorated_function