Fix bug with signups and disabled users

* Token field for password was not being set.
* Have also added to test to confirm this.

Change-Id: I5e9c21ee4675181f21a889bfe7187995db05576a
This commit is contained in:
adrian-turjak 2017-05-23 21:44:37 +12:00
parent f1f0a6d87b
commit ca21dabdf8
3 changed files with 6 additions and 1 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
*.sqlite3
*~
*.log
adjutant.egg-info/*
python_adjutant.egg-info/*
dist/*
.tox/*
env/*

View File

@ -166,6 +166,8 @@ class NewProjectWithUserAction(UserNameAction, ProjectMixin, UserMixin):
# add to cache to use in template
self.action.task.cache['user_state'] = "disabled"
self.action.need_token = True
# as they are disabled we'll reset their password
self.set_token_fields(["password"])
self.add_note(
"Existing disabled user '%s' with matching email." %
self.email)

View File

@ -300,6 +300,9 @@ class ProjectActionTests(TestCase):
{'user_id': 'user_id_1',
'project_id': 'project_id_1',
'user_state': 'disabled'})
self.assertEquals(
action.action.cache["token_fields"],
['password'])
# submit password reset
token_data = {'password': '123456'}