Browse Source
Merge pull request #1076 from StefanRijnhart/fix/9.0/password_security/underscore
[FIX] Underscore is a special character
pull/1088/head
Pedro M. Baeza
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
2 deletions
-
password_security/__openerp__.py
-
password_security/models/res_users.py
-
password_security/tests/test_res_users.py
|
|
@ -5,7 +5,7 @@ |
|
|
|
|
|
|
|
'name': 'Password Security', |
|
|
|
"summary": "Allow admin to set password security requirements.", |
|
|
|
'version': '9.0.1.2.0', |
|
|
|
'version': '9.0.1.2.1', |
|
|
|
'author': "LasLabs, Odoo Community Association (OCA)", |
|
|
|
'category': 'Base', |
|
|
|
'depends': [ |
|
|
|
|
|
@ -78,7 +78,7 @@ class ResUsers(models.Model): |
|
|
|
if company_id.password_numeric: |
|
|
|
password_regex.append(r'(?=.*?\d)') |
|
|
|
if company_id.password_special: |
|
|
|
password_regex.append(r'(?=.*?\W)') |
|
|
|
password_regex.append(r'(?=.*?[\W_])') |
|
|
|
password_regex.append('.{%d,}$' % company_id.password_length) |
|
|
|
if not re.search(''.join(password_regex), password): |
|
|
|
raise PassError(_(self.password_match_message())) |
|
|
|
|
|
@ -155,3 +155,8 @@ class TestResUsers(TransactionCase): |
|
|
|
self.assertEqual( |
|
|
|
True, rec_id._validate_pass_reset(), |
|
|
|
) |
|
|
|
|
|
|
|
def test_underscore_is_special_character(self): |
|
|
|
self.assertTrue(self.main_comp.password_special) |
|
|
|
rec_id = self._new_record() |
|
|
|
rec_id.check_password('asdQWE12345_3') |