Display and error and redirect to login page if unauthenticated user tries to access...
authorAaron Williamson <aaron@copiesofcopies.org>
Sat, 1 Oct 2011 23:49:56 +0000 (19:49 -0400)
committerAaron Williamson <aaron@copiesofcopies.org>
Sat, 1 Oct 2011 23:49:56 +0000 (19:49 -0400)
mediagoblin/auth/views.py

index b6f38fec92c984342d8ac288d266581df08a40f4..d91a1f254bf170c6b5cceed4ce243f30f387c99b 100644 (file)
@@ -21,7 +21,7 @@ from webob import exc
 
 from mediagoblin import messages
 from mediagoblin import mg_globals
-from mediagoblin.util import render_to_response, redirect, render_404
+from mediagoblin.util import render_to_response, redirect, render_404, setup_user_in_request
 from mediagoblin.util import pass_to_ugettext as _
 from mediagoblin.db.util import ObjectId, InvalidId
 from mediagoblin.auth import lib as auth_lib
@@ -195,9 +195,18 @@ def resend_activation(request):
 
     Resend the activation email.
     """
+
+    if not request.GET.has_key('userid') or not request.GET.has_key('token'):
+        messages.add_message(
+            request,
+            messages.ERROR,
+            _('You must be logged in so we know who to send the email to!'))
+        
+        return redirect(request, "/auth/login")
+
     request.user[u'verification_key'] = unicode(uuid.uuid4())
     request.user.save()
-
+    
     email_debug_message(request)
     send_verification_email(request.user, request)