File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88from django .contrib .auth .models import User
99from django .conf import settings
1010
11- from ietf .utils .test_utils import TestCase , login_testing_unauthorized
11+ from ietf .utils .test_utils import TestCase , login_testing_unauthorized , unicontent
1212from ietf .utils .test_data import make_test_data
1313from ietf .utils .mail import outbox , empty_outbox
1414from ietf .person .models import Person , Email
@@ -89,6 +89,7 @@ def test_create_account(self):
8989 empty_outbox ()
9090 r = self .client .post (url , { 'email' : email })
9191 self .assertEqual (r .status_code , 200 )
92+ self .assertTrue ("Account created" in unicontent (r .content ))
9293 self .assertEqual (len (outbox ), 1 )
9394
9495 # go to confirm page
Original file line number Diff line number Diff line change @@ -80,7 +80,8 @@ def index(request):
8080# return HttpResponseRedirect(redirect_to)
8181
8282def create_account (request ):
83- success = False
83+ to_email = None
84+
8485 if request .method == 'POST' :
8586 form = RegistrationForm (request .POST )
8687 if form .is_valid ():
@@ -103,7 +104,7 @@ def create_account(request):
103104
104105 return render (request , 'registration/create.html' , {
105106 'form' : form ,
106- 'success ' : success ,
107+ 'to_email ' : to_email ,
107108 })
108109
109110def confirm_account (request , auth ):
@@ -140,10 +141,12 @@ def confirm_account(request, auth):
140141 name = email ,
141142 ascii = email )
142143 if not email_obj :
143- email_obj = Email .objects .create (address = email ,
144- person = person )
145- email_obj .person = person
146- email_obj .save ()
144+ email_obj = Email .objects .create (address = email , person = person )
145+ else :
146+ if not email_obj .person :
147+ email_obj .person = person
148+ email_obj .save ()
149+
147150 person .user = user
148151 person .save ()
149152
@@ -315,6 +318,8 @@ def confirm_password_reset(request, auth):
315318 user .save ()
316319 # password is also stored in htpasswd file
317320 save_htpasswd_file (user .username , password )
321+
322+ success = True
318323 else :
319324 form = PasswordForm ()
320325
Original file line number Diff line number Diff line change 99{% block content %}
1010 {% origin %}
1111
12- {% if success %}
12+ {% if to_email %}
1313 < h1 > Account created successfully</ h1 >
14+
1415 < p > Your account creation request has been successfully received.</ p >
15- < p > We have sent you an email with instructions on how to complete the process.</ p >
16+
17+ < p > We have sent an email to {{ to_email }} with instructions on how to complete the process.</ p >
1618
1719 {% else %}
1820 < div class ="row ">
You can’t perform that action at this time.
0 commit comments