From 28afb47ca82b0857aad546ef4cbf869de1ca95a5 Mon Sep 17 00:00:00 2001 From: Aleksandar Micovic Date: Mon, 30 May 2011 23:51:30 -0400 Subject: [PATCH] Added a temporary verification page informing the user they need to authenticate. --- mediagoblin/auth/routing.py | 4 ++- mediagoblin/auth/views.py | 15 ++++++++++ mediagoblin/decorators.py | 2 +- .../mediagoblin/auth/verification_needed.html | 29 +++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 mediagoblin/templates/mediagoblin/auth/verification_needed.html diff --git a/mediagoblin/auth/routing.py b/mediagoblin/auth/routing.py index 59762840..9544b165 100644 --- a/mediagoblin/auth/routing.py +++ b/mediagoblin/auth/routing.py @@ -26,4 +26,6 @@ auth_routes = [ Route('mediagoblin.auth.logout', '/logout/', controller='mediagoblin.auth.views:logout'), Route('mediagoblin.auth.verify_email', '/verify_email/', - controller='mediagoblin.auth.views:verify_email')] + controller='mediagoblin.auth.views:verify_email'), + Route('mediagoblin.auth.verify_email_notice', '/verification_required/', + controller='mediagoblin.auth.views:verify_email_notice')] diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 6b5ce88c..edac74a8 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -168,3 +168,18 @@ def verify_email(request): {'request': request, 'user': user, 'verification_successful': verification_successful})) + +def verify_email_notice(request): + """ + Verify warning view. + + When the user tries to do some action that requires their account + to be verified beforehand, this view is called upon! + """ + + template = request.template_env.get_template( + 'mediagoblin/auth/verification_needed.html') + return Response( + template.render( + {'request': request})) + diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index ff3f0b5e..bb625667 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -41,7 +41,7 @@ def require_active_login(controller): # here because an *active* user is required. return exc.HTTPFound( location="%s?next=%s" % ( - request.urlgen("mediagoblin.auth.login"), + request.urlgen("mediagoblin.auth.verify_email_notice"), request.path_info)) return controller(request, *args, **kwargs) diff --git a/mediagoblin/templates/mediagoblin/auth/verification_needed.html b/mediagoblin/templates/mediagoblin/auth/verification_needed.html new file mode 100644 index 00000000..26ea84dc --- /dev/null +++ b/mediagoblin/templates/mediagoblin/auth/verification_needed.html @@ -0,0 +1,29 @@ +{# +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011 Free Software Foundation, Inc +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +#} +{% extends "mediagoblin/base.html" %} + +{% block mediagoblin_content %} +

+ Verfication needed!
+ Please check your email to verify your account. +

+ +

+ Still haven't received an email? Click here to resend it. +

+{% endblock %} -- 2.25.1