Commit c98b0deb authored by Jérome Perrin's avatar Jérome Perrin

PasswordTool: fix password_confirm argument

It was wrongly named password_confirmation in some places and this was
silently ignored because the parameter is not used at the moment and
because of **kw in the signature.

This is a preparatory commit so that we can check that the password and
the confirmation match
parent 98ac3e7b
...@@ -128,7 +128,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -128,7 +128,7 @@ class TestPasswordTool(ERP5TypeTestCase):
ret = self.portal.portal_password.changeUserPassword( ret = self.portal.portal_password.changeUserPassword(
user_login="userA-login", user_login="userA-login",
password="new-password", password="new-password",
password_confirmation="new-password", password_confirm="new-password",
password_key=reset_key) password_key=reset_key)
query_string_param = parse_qsl(urlparse(str(ret)).query) query_string_param = parse_qsl(urlparse(str(ret)).query)
self.assertIn(("portal_status_message", "Password changed."), query_string_param) self.assertIn(("portal_status_message", "Password changed."), query_string_param)
...@@ -140,7 +140,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -140,7 +140,7 @@ class TestPasswordTool(ERP5TypeTestCase):
ret = self.portal.portal_password.changeUserPassword( ret = self.portal.portal_password.changeUserPassword(
user_login="userA-login", user_login="userA-login",
password="new-password", password="new-password",
password_confirmation="new-password", password_confirm="new-password",
password_key=reset_key) password_key=reset_key)
query_string_param = parse_qsl(urlparse(str(ret)).query) query_string_param = parse_qsl(urlparse(str(ret)).query)
self.assertIn(("portal_status_message", "Key not known. Please ask reset password."), query_string_param) self.assertIn(("portal_status_message", "Key not known. Please ask reset password."), query_string_param)
...@@ -174,7 +174,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -174,7 +174,7 @@ class TestPasswordTool(ERP5TypeTestCase):
ret = self.portal.portal_password.changeUserPassword( ret = self.portal.portal_password.changeUserPassword(
user_login="userB-login", user_login="userB-login",
password="new-password", password="new-password",
password_confirmation="new-password", password_confirm="new-password",
password_key=reset_key) password_key=reset_key)
query_string_param = parse_qsl(urlparse(str(ret)).query) query_string_param = parse_qsl(urlparse(str(ret)).query)
self.assertIn(("portal_status_message", "Bad login provided."), query_string_param) self.assertIn(("portal_status_message", "Bad login provided."), query_string_param)
...@@ -189,7 +189,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -189,7 +189,7 @@ class TestPasswordTool(ERP5TypeTestCase):
ret = self.portal.portal_password.changeUserPassword( ret = self.portal.portal_password.changeUserPassword(
user_login="userA-login", user_login="userA-login",
password="new-password", password="new-password",
password_confirmation="new-password", password_confirm="new-password",
password_key='wrong key') password_key='wrong key')
query_string_param = parse_qsl(urlparse(str(ret)).query) query_string_param = parse_qsl(urlparse(str(ret)).query)
self.assertIn(("portal_status_message", "Key not known. Please ask reset password."), query_string_param) self.assertIn(("portal_status_message", "Key not known. Please ask reset password."), query_string_param)
...@@ -207,7 +207,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -207,7 +207,7 @@ class TestPasswordTool(ERP5TypeTestCase):
ret = self.portal.portal_password.changeUserPassword( ret = self.portal.portal_password.changeUserPassword(
user_login="userA-login", user_login="userA-login",
password="new-password", password="new-password",
password_confirmation="new-password", password_confirm="new-password",
password_key=reset_key) password_key=reset_key)
query_string_param = parse_qsl(urlparse(str(ret)).query) query_string_param = parse_qsl(urlparse(str(ret)).query)
self.assertIn(("portal_status_message", "Date has expired."), query_string_param) self.assertIn(("portal_status_message", "Date has expired."), query_string_param)
...@@ -243,7 +243,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -243,7 +243,7 @@ class TestPasswordTool(ERP5TypeTestCase):
self.portal.portal_password.changeUserPassword(user_login="userA-login", self.portal.portal_password.changeUserPassword(user_login="userA-login",
password="newA", password="newA",
password_confirmation="newA", password_confirm="newA",
password_key=key_a) password_key=key_a)
self.tic() self.tic()
...@@ -252,7 +252,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -252,7 +252,7 @@ class TestPasswordTool(ERP5TypeTestCase):
self.portal.portal_password.changeUserPassword(user_login="userB-login", self.portal.portal_password.changeUserPassword(user_login="userB-login",
password="newB", password="newB",
password_confirmation="newB", password_confirm="newB",
password_key=key_b) password_key=key_b)
self.tic() self.tic()
...@@ -290,7 +290,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -290,7 +290,7 @@ class TestPasswordTool(ERP5TypeTestCase):
# Check that password is not changed if trailing space is not entered # Check that password is not changed if trailing space is not entered
self.portal.portal_password.changeUserPassword(user_login="userZ-login", self.portal.portal_password.changeUserPassword(user_login="userZ-login",
password="newZ", password="newZ",
password_confirmation="newZ", password_confirm="newZ",
password_key=key_a) password_key=key_a)
self.tic() self.tic()
self._assertUserExists('userZ-login ', 'passwordZ') self._assertUserExists('userZ-login ', 'passwordZ')
...@@ -298,7 +298,7 @@ class TestPasswordTool(ERP5TypeTestCase): ...@@ -298,7 +298,7 @@ class TestPasswordTool(ERP5TypeTestCase):
# Check that password is changed if trailing space is entered # Check that password is changed if trailing space is entered
self.portal.portal_password.changeUserPassword(user_login="userZ-login ", self.portal.portal_password.changeUserPassword(user_login="userZ-login ",
password="newZ2", password="newZ2",
password_confirmation="newZ2", password_confirm="newZ2",
password_key=key_a) password_key=key_a)
self.tic() self.tic()
self._assertUserExists('userZ-login ', 'newZ2') self._assertUserExists('userZ-login ', 'newZ2')
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
""" """
REQUEST = context.REQUEST REQUEST = context.REQUEST
next_url = context.portal_password.changeUserPassword(password=REQUEST['password'], next_url = context.portal_password.changeUserPassword(password=REQUEST['password'],
password_confirmation=REQUEST['password_confirm'], password_confirm=REQUEST['password_confirm'],
password_key=REQUEST['password_key'], password_key=REQUEST['password_key'],
user_login=REQUEST.get('user_login', None), user_login=REQUEST.get('user_login', None),
REQUEST=REQUEST) REQUEST=REQUEST)
......
REQUEST = context.REQUEST REQUEST = context.REQUEST
return context.portal_password.changeUserPassword(password=REQUEST['password'], return context.portal_password.changeUserPassword(password=REQUEST['password'],
password_confirmation=REQUEST['password_confirm'], password_confirm=REQUEST['password_confirm'],
password_key=REQUEST['password_key'], password_key=REQUEST['password_key'],
user_login=REQUEST.get('user_login', None), user_login=REQUEST.get('user_login', None),
REQUEST=REQUEST) REQUEST=REQUEST)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment