From 3dc0b70a2b1584b900bc4773c21a58ea39dd7c6a Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Fri, 13 Sep 2019 22:10:30 -0400 Subject: nfsw/auth.py: Add anon_only decorator. --- nfsw/auth.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nfsw/auth.py b/nfsw/auth.py index 1850f50..d540a9a 100644 --- a/nfsw/auth.py +++ b/nfsw/auth.py @@ -27,3 +27,14 @@ def login_required(view): return wrapped_view +def anon_only(view): + @functools.wraps(view) + def wrapped_view(**kwargs): + if g.user is not None: + return redirect(url_for('io')) + + return view(**kwargs) + + return wrapped_view + + -- cgit v1.2.3