2
0
mirror of https://github.com/codl/forget synced 2025-01-10 14:42:49 +01:00
forget-cancellare-vecchi-toot/lib/auth.py

19 lines
380 B
Python

from flask import g, redirect
def require_auth(fun, redir=True):
from functools import update_wrapper
def wrapper(*args, **kwargs):
if not g.viewer:
if redir:
return redirect('/')
else:
return 403
else:
return fun(*args, **kwargs)
update_wrapper(wrapper, fun)
return wrapper