From 82780edbfb98c2b784adb642b2cd8a8a15d033c8 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Fri, 13 Sep 2019 22:11:01 -0400 Subject: nfsw/auth.py: Add not_agreed decorator. --- nfsw/auth.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nfsw/auth.py b/nfsw/auth.py index d540a9a..769a5dd 100644 --- a/nfsw/auth.py +++ b/nfsw/auth.py @@ -38,3 +38,14 @@ def anon_only(view): return wrapped_view +def not_agreed(view): + @functools.wraps(view) + def wrapped_view(**kwargs): + if g.user['terms_agreed']: + return redirect(url_for('io')) + + return view(**kwargs) + + return wrapped_view + + -- cgit v1.2.3