log a previously logged in user when switched to no_auth mode
authorRodney Ewing <ewing.rj@gmail.com>
Fri, 17 May 2013 17:50:46 +0000 (10:50 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Fri, 24 May 2013 23:52:49 +0000 (16:52 -0700)
mediagoblin/app.py
mediagoblin/auth/tools.py

index 51c597aa7960f593abcb2b8b10446a22917a417d..982e570c146a2a1346ab6f2a0a6f6a7a39e93025 100644 (file)
@@ -37,7 +37,7 @@ from mediagoblin.init import (get_jinja_loader, get_staticdirector,
     setup_storage)
 from mediagoblin.tools.pluginapi import PluginManager, hook_transform
 from mediagoblin.tools.crypto import setup_crypto
-from mediagoblin.auth.tools import check_auth_enabled
+from mediagoblin.auth.tools import check_auth_enabled, no_auth_logout
 
 
 _log = logging.getLogger(__name__)
@@ -192,6 +192,9 @@ class MediaGoblinApp(object):
 
         mg_request.setup_user_in_request(request)
 
+        # Log user out if in no_auth mode
+        no_auth_logout(request)
+
         request.controller_name = None
         try:
             found_rule, url_values = map_adapter.match(return_rule=True)
index bd171261898e5b8fd5bc9ab497a03922b69d8666..7d051a667d399f1dabc095a219c383c6bdee5880 100644 (file)
@@ -76,3 +76,9 @@ def check_auth_enabled():
         return False
     else:
         return True
+
+
+def no_auth_logout(request):
+    """Log out the user if in no_auth mode"""
+    if not mg_globals.app.auth:
+        request.session.delete()