13 lines
292 B
Python
13 lines
292 B
Python
|
|
from functools import wraps
|
||
|
|
|
||
|
|
from flask import redirect, session, url_for
|
||
|
|
|
||
|
|
|
||
|
|
def login_required(f):
|
||
|
|
@wraps(f)
|
||
|
|
def decorated(*args, **kwargs):
|
||
|
|
if "user_id" not in session:
|
||
|
|
return redirect(url_for("auth.index"))
|
||
|
|
return f(*args, **kwargs)
|
||
|
|
|
||
|
|
return decorated
|