diff options
author | Aleksandar Micovic <aleks.micovic@gmail.com> | 2011-05-31 17:14:23 -0400 |
---|---|---|
committer | Aleksandar Micovic <aleks.micovic@gmail.com> | 2011-05-31 17:14:23 -0400 |
commit | b93a6a229e1c7a7eef76e8322104912378f79a96 (patch) | |
tree | 4a7f20d154ce98cb075ef1e194e5d3ff97ea39ca /mediagoblin/auth/views.py | |
parent | bcec749b52c287a6d361fd06bfbd833e03e5b478 (diff) | |
download | mediagoblin-b93a6a229e1c7a7eef76e8322104912378f79a96.tar.lz mediagoblin-b93a6a229e1c7a7eef76e8322104912378f79a96.tar.xz mediagoblin-b93a6a229e1c7a7eef76e8322104912378f79a96.zip |
Added the ability to regenerate a verification key.
Diffstat (limited to 'mediagoblin/auth/views.py')
-rw-r--r-- | mediagoblin/auth/views.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index edac74a8..22fdd46b 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -183,3 +183,44 @@ def verify_email_notice(request): template.render( {'request': request})) +def resend_activation(request): + """ + The reactivation view + + Resend the activation email. + """ + + request.user.generate_new_verification_key() + + # Copied shamelessly from the register view above. + + email_template = request.template_env.get_template( + 'mediagoblin/auth/verification_email.txt') + + # TODO: There is no error handling in place + send_email( + mgoblin_globals.email_sender_address, + [request.user['email']], + # TODO + # Due to the distributed nature of GNU MediaGoblin, we should + # find a way to send some additional information about the + # specific GNU MediaGoblin instance in the subject line. For + # example "GNU MediaGoblin @ Wandborg - [...]". + 'GNU MediaGoblin - Verify email', + email_template.render( + username=request.user['username'], + verification_url='http://{host}{uri}?userid={userid}&token={verification_key}'.format( + host=request.host, + uri=request.urlgen('mediagoblin.auth.verify_email'), + userid=unicode(request.user['_id']), + verification_key=request.user['verification_key']))) + + + # TODO: For now, we use the successful registration page until we get a + # proper messaging system. + + template = request.template_env.get_template( + 'mediagoblin/auth/register_success.html') + return exc.HTTPFound( + location=request.urlgen('mediagoblin.auth.register_success')) + |