From: Aaron Williamson Date: Sat, 1 Oct 2011 23:49:56 +0000 (-0400) Subject: Display and error and redirect to login page if unauthenticated user tries to access... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=84a7e7706c8b1239f8fd52c604afbb10c776ac04;p=mediagoblin.git Display and error and redirect to login page if unauthenticated user tries to access resend_verification. --- diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index b6f38fec..d91a1f25 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -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)