Merge remote branch 'remotes/gullydwarf-cfdv/f424_email_verified_messaging'
This commit is contained in:
commit
2f4e62c210
@ -18,6 +18,7 @@ import uuid
|
|||||||
|
|
||||||
from webob import exc
|
from webob import exc
|
||||||
|
|
||||||
|
from mediagoblin import messages
|
||||||
from mediagoblin.util import render_to_response, redirect
|
from mediagoblin.util import render_to_response, redirect
|
||||||
from mediagoblin.db.util import ObjectId
|
from mediagoblin.db.util import ObjectId
|
||||||
from mediagoblin.auth import lib as auth_lib
|
from mediagoblin.auth import lib as auth_lib
|
||||||
@ -124,14 +125,21 @@ def verify_email(request):
|
|||||||
if user and user['verification_key'] == unicode(request.GET['token']):
|
if user and user['verification_key'] == unicode(request.GET['token']):
|
||||||
user['status'] = u'active'
|
user['status'] = u'active'
|
||||||
user['email_verified'] = True
|
user['email_verified'] = True
|
||||||
verification_successful = True
|
|
||||||
user.save()
|
user.save()
|
||||||
|
verification_successful = True
|
||||||
|
messages.add_message(request,
|
||||||
|
messages.SUCCESS,
|
||||||
|
'Your email address has been verified. ' \
|
||||||
|
'You may now login!')
|
||||||
else:
|
else:
|
||||||
verification_successful = False
|
verification_successful = False
|
||||||
|
messages.add_message(request,
|
||||||
|
messages.ERROR,
|
||||||
|
'The verification key or user id is incorrect')
|
||||||
|
|
||||||
return render_to_response(
|
return render_to_response(
|
||||||
request,
|
request,
|
||||||
'mediagoblin/auth/verify_email.html',
|
'mediagoblin/user_pages/user.html',
|
||||||
{'user': user,
|
{'user': user,
|
||||||
'verification_successful' : verification_successful})
|
'verification_successful' : verification_successful})
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
{#
|
|
||||||
# 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 <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "mediagoblin/base.html" %}
|
|
||||||
|
|
||||||
{% block mediagoblin_content %}
|
|
||||||
<p>
|
|
||||||
{% if verification_successful %}
|
|
||||||
Your email address has been verified!
|
|
||||||
{% else %}
|
|
||||||
The verification key or user id is incorrect
|
|
||||||
{% endif %}
|
|
||||||
</p>
|
|
||||||
{% endblock %}
|
|
@ -189,7 +189,7 @@ def test_register_views(test_app):
|
|||||||
"/auth/verify_email/?userid=%s&token=total_bs" % unicode(
|
"/auth/verify_email/?userid=%s&token=total_bs" % unicode(
|
||||||
new_user['_id']))
|
new_user['_id']))
|
||||||
context = util.TEMPLATE_TEST_CONTEXT[
|
context = util.TEMPLATE_TEST_CONTEXT[
|
||||||
'mediagoblin/auth/verify_email.html']
|
'mediagoblin/user_pages/user.html']
|
||||||
assert context['verification_successful'] == False
|
assert context['verification_successful'] == False
|
||||||
new_user = mg_globals.database.User.find_one(
|
new_user = mg_globals.database.User.find_one(
|
||||||
{'username': 'happygirl'})
|
{'username': 'happygirl'})
|
||||||
@ -201,7 +201,7 @@ def test_register_views(test_app):
|
|||||||
util.clear_test_template_context()
|
util.clear_test_template_context()
|
||||||
test_app.get("%s?%s" % (path, get_params))
|
test_app.get("%s?%s" % (path, get_params))
|
||||||
context = util.TEMPLATE_TEST_CONTEXT[
|
context = util.TEMPLATE_TEST_CONTEXT[
|
||||||
'mediagoblin/auth/verify_email.html']
|
'mediagoblin/user_pages/user.html']
|
||||||
assert context['verification_successful'] == True
|
assert context['verification_successful'] == True
|
||||||
new_user = mg_globals.database.User.find_one(
|
new_user = mg_globals.database.User.find_one(
|
||||||
{'username': 'happygirl'})
|
{'username': 'happygirl'})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user