Merge remote branch 'remotes/aaronw/bug614_verification_crash'

* remotes/aaronw/bug614_verification_crash:
  Update english translation file.
  Reverse order of sanity checks: check email_verified after making sure there's a user in the request.
  Make sure user isn't already verified before resending verification.
  Check request.user to determine if user is logged in.
  Regenerated English .po file to include new string.
  Display and error and redirect to login page if unauthenticated user tries to access resend_verification.

Conflicts:
	mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po
This commit is contained in:
Elrond 2011-11-20 20:00:08 +01:00
commit e51af0e620
2 changed files with 28 additions and 3 deletions

View File

@ -195,6 +195,23 @@ def resend_activation(request):
Resend the activation email.
"""
if request.user is None:
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")
if request.user["email_verified"]:
messages.add_message(
request,
messages.ERROR,
_("You've already verified your email address!"))
return redirect(request, "mediagoblin.user_pages.user_home", user=request.user['username'])
request.user[u'verification_key'] = unicode(uuid.uuid4())
request.user.save()

View File

@ -63,11 +63,19 @@ msgstr ""
msgid "The verification key or user id is incorrect"
msgstr ""
#: mediagoblin/auth/views.py:207
#: mediagoblin/auth/views.py:203
msgid "You must be logged in so we know who to send the email to!"
msgstr ""
#: mediagoblin/auth/views.py:211
msgid "You've already verified your email address!"
msgstr ""
#: mediagoblin/auth/views.py:224
msgid "Resent your verification email."
msgstr ""
#: mediagoblin/auth/views.py:248
#: mediagoblin/auth/views.py:265
msgid ""
"Could not send password recovery email as your username is inactive or "
"your account's email address has not been verified."