Allow logins in /admin/ as well
authorMagnus Hagander <magnus@hagander.net>
Tue, 24 May 2016 19:39:22 +0000 (21:39 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 24 May 2016 19:39:22 +0000 (21:39 +0200)
Required for our custom admin pages.

pgweb/util/decorators.py

index d30625779b46291fb49a278eb6900de1e796191a..16d968b541b747870daf74d73a4151f7cf0d8133 100644 (file)
@@ -28,7 +28,7 @@ def login_required(f):
        @wraps(f)
        def wrapper(*args, **kwargs):
                request = args[0]
-               if not request.path.startswith('/account/'):
+               if not (request.path.startswith('/account/') or reqeust.path.startswith('/admin/')):
                        raise Exception("Login required in bad path, aborting with exception.")
                return django_login_required(f)(*args, **kwargs)
        return wrapper