Fixed bug where someone who wasn't logged in was asked to verify
authorAleksandar Micovic <aleks.micovic@gmail.com>
Tue, 31 May 2011 19:26:00 +0000 (15:26 -0400)
committerAleksandar Micovic <aleks.micovic@gmail.com>
Tue, 31 May 2011 19:26:00 +0000 (15:26 -0400)
their emails.

mediagoblin/decorators.py

index bb625667461a79b60f11f867699c09b3e4328074..bc12d61c2e28a7644ef83e3264dcb334cf22490d 100644 (file)
@@ -36,12 +36,13 @@ def require_active_login(controller):
     Require an active login from the user.
     """
     def new_controller_func(request, *args, **kwargs):
-        if not request.user or not request.user.get('status') == u'active':
-            # TODO: Indicate to the user that they were redirected
-            # here because an *active* user is required.
+        if request.user and request.user.get('status') == u'needs_email_verification':
+            return exc.HTTPFound(
+                location = request.urlgen('mediagoblin.auth.verify_email_notice'))
+        elif not request.user or request.user.get('status') != u'active':
             return exc.HTTPFound(
                 location="%s?next=%s" % (
-                    request.urlgen("mediagoblin.auth.verify_email_notice"),
+                    request.urlgen("mediagoblin.auth.login"),
                     request.path_info))
 
         return controller(request, *args, **kwargs)