[FIX] base: Changing password with false as new value

Before clicking on 'Change Password' button, a new password must be
written. Otherwise an error was raised: TypeError: secret must be
unicode or bytes, not bool.

opw:777921
This commit is contained in:
Goffin Simon
2017-10-25 13:35:41 +02:00
parent 87b2f3fadd
commit c7a6409fac
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -19704,6 +19704,12 @@ msgstr ""
msgid "yes"
msgstr ""
#. module: base
#: code:addons/base/res/res_users.py:955
#, python-format
msgid "Before clicking on 'Change Password', you have to write a new password."
msgstr ""
#. module: base
#: model:res.country,name:base.ax
msgid "Åland Islands"
+2
View File
@@ -950,6 +950,8 @@ class ChangePasswordUser(models.TransientModel):
@api.multi
def change_password_button(self):
for line in self:
if not line.new_passwd:
raise UserError(_("Before clicking on 'Change Password', you have to write a new password."))
line.user_id.write({'password': line.new_passwd})
# don't keep temporary passwords in the database longer than necessary
self.write({'new_passwd': False})