Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions password_security/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ def _check_password_rules(self, password):
password_regex.append('.{%d,}$' % company_id.password_length)
if not re.search(''.join(password_regex), password):
raise PassError(self.password_match_message())
if company_id.password_no_login and self.login in password:
raise PassError(self.password_match_message())
if company_id.password_no_login:
if self.login.lower() in password.lower():
raise PassError(self.password_match_message())
return True

@api.multi
Expand Down
4 changes: 2 additions & 2 deletions password_security/tests/test_res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ def test_underscore_is_special_character(self):
def test_password_contains_login(self):
self.assertTrue(self.main_comp.password_no_login)
rec_id = self._new_record()
rec_id._check_password('asdQWE123$%^12')
rec_id.login = 'suzanne'
with self.assertRaises(PassError):
rec_id._check_password(rec_id.login + 'invalid')
rec_id._check_password('Suzanne1966!')