Fix a couple of bugs in the account registration cleanup
- Legacy-Id: 11167
This commit is contained in:
parent
a99aa32c59
commit
5bcf36e149
|
@ -8,7 +8,7 @@ from django.core.urlresolvers import reverse as urlreverse
|
|||
from django.contrib.auth.models import User
|
||||
from django.conf import settings
|
||||
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized, unicontent
|
||||
from ietf.utils.test_data import make_test_data
|
||||
from ietf.utils.mail import outbox, empty_outbox
|
||||
from ietf.person.models import Person, Email
|
||||
|
@ -89,6 +89,7 @@ class IetfAuthTests(TestCase):
|
|||
empty_outbox()
|
||||
r = self.client.post(url, { 'email': email })
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertTrue("Account created" in unicontent(r.content))
|
||||
self.assertEqual(len(outbox), 1)
|
||||
|
||||
# go to confirm page
|
||||
|
|
|
@ -80,7 +80,8 @@ def index(request):
|
|||
# return HttpResponseRedirect(redirect_to)
|
||||
|
||||
def create_account(request):
|
||||
success = False
|
||||
to_email = None
|
||||
|
||||
if request.method == 'POST':
|
||||
form = RegistrationForm(request.POST)
|
||||
if form.is_valid():
|
||||
|
@ -103,7 +104,7 @@ def create_account(request):
|
|||
|
||||
return render(request, 'registration/create.html', {
|
||||
'form': form,
|
||||
'success': success,
|
||||
'to_email': to_email,
|
||||
})
|
||||
|
||||
def confirm_account(request, auth):
|
||||
|
@ -140,10 +141,12 @@ def confirm_account(request, auth):
|
|||
name=email,
|
||||
ascii=email)
|
||||
if not email_obj:
|
||||
email_obj = Email.objects.create(address=email,
|
||||
person=person)
|
||||
email_obj.person = person
|
||||
email_obj.save()
|
||||
email_obj = Email.objects.create(address=email, person=person)
|
||||
else:
|
||||
if not email_obj.person:
|
||||
email_obj.person = person
|
||||
email_obj.save()
|
||||
|
||||
person.user = user
|
||||
person.save()
|
||||
|
||||
|
@ -315,6 +318,8 @@ def confirm_password_reset(request, auth):
|
|||
user.save()
|
||||
# password is also stored in htpasswd file
|
||||
save_htpasswd_file(user.username, password)
|
||||
|
||||
success = True
|
||||
else:
|
||||
form = PasswordForm()
|
||||
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
{% block content %}
|
||||
{% origin %}
|
||||
|
||||
{% if success %}
|
||||
{% if to_email %}
|
||||
<h1>Account created successfully</h1>
|
||||
|
||||
<p>Your account creation request has been successfully received.</p>
|
||||
<p>We have sent you an email with instructions on how to complete the process.</p>
|
||||
|
||||
<p>We have sent an email to {{ to_email }} with instructions on how to complete the process.</p>
|
||||
|
||||
{% else %}
|
||||
<div class="row">
|
||||
|
|
Loading…
Reference in a new issue