Skip to content

Commit 1f7598b

Browse files
committed
[MIG] password_security: Migrate to v10
* Bump versions * Installable to True * Add Usage section to ReadMe w/ Runbot link * `_crypt_context` now directly exposes the `CryptContext` * Change all instances of openerp to odoo
1 parent 97e28b7 commit 1f7598b

10 files changed

+27
-17
lines changed

password_security/README.rst

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ These are defined at the company level:
4747
password_minimum 24 Amount of hours that must pass until another reset
4848
===================== ======= ===================================================
4949

50+
Usage
51+
=====
52+
53+
Configure using above instructions for each company that should have password
54+
security mandates.
55+
56+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
57+
:alt: Try me on Runbot
58+
:target: https://runbot.odoo-community.org/runbot/149/10.0
59+
5060
Known Issues / Roadmap
5161
======================
5262

password_security/__manifest__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
'name': 'Password Security',
77
"summary": "Allow admin to set password security requirements.",
8-
'version': '9.0.1.0.2',
8+
'version': '10.0.1.0.0',
99
'author': "LasLabs, Odoo Community Association (OCA)",
1010
'category': 'Base',
1111
'depends': [
@@ -19,5 +19,5 @@
1919
'security/ir.model.access.csv',
2020
'security/res_users_pass_history.xml',
2121
],
22-
'installable': False,
22+
'installable': True,
2323
}

password_security/controllers/main.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
import operator
66

7-
from openerp import http
8-
from openerp.http import request
9-
from openerp.addons.auth_signup.controllers.main import AuthSignupHome
10-
from openerp.addons.web.controllers.main import ensure_db, Session
7+
from odoo import http
8+
from odoo.http import request
9+
from odoo.addons.auth_signup.controllers.main import AuthSignupHome
10+
from odoo.addons.web.controllers.main import ensure_db, Session
1111

1212
from ..exceptions import PassError
1313

password_security/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright 2015 LasLabs Inc.
33
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
44

5-
from openerp.exceptions import Warning as UserError
5+
from odoo.exceptions import Warning as UserError
66

77

88
class PassError(UserError):

password_security/models/res_company.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright 2015 LasLabs Inc.
33
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
44

5-
from openerp import models, fields
5+
from odoo import models, fields
66

77

88
class ResCompany(models.Model):

password_security/models/res_users.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from datetime import datetime, timedelta
88

9-
from openerp import api, fields, models, _
9+
from odoo import api, fields, models, _
1010

1111
from ..exceptions import PassError
1212

@@ -129,7 +129,7 @@ def _set_password(self, password):
129129
""" It validates proposed password against existing history
130130
:raises: PassError on reused password
131131
"""
132-
crypt = self._crypt_context()[0]
132+
crypt = self._crypt_context()
133133
for rec_id in self:
134134
recent_passes = rec_id.company_id.password_history
135135
if recent_passes < 0:

password_security/models/res_users_pass_history.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright 2016 LasLabs Inc.
33
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
44

5-
from openerp import fields, models
5+
from odoo import fields, models
66

77

88
class ResUsersPassHistory(models.Model):

password_security/tests/test_password_security_home.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
from contextlib import contextmanager
88

9-
from openerp.tests.common import TransactionCase
10-
from openerp.http import Response
9+
from odoo.tests.common import TransactionCase
10+
from odoo.http import Response
1111

1212
from ..controllers import main
1313

1414

15-
IMPORT = 'openerp.addons.password_security.controllers.main'
15+
IMPORT = 'odoo.addons.password_security.controllers.main'
1616

1717

1818
class EndTestException(Exception):

password_security/tests/test_password_security_session.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
from contextlib import contextmanager
88

9-
from openerp.tests.common import TransactionCase
9+
from odoo.tests.common import TransactionCase
1010

1111
from ..controllers import main
1212

1313

14-
IMPORT = 'openerp.addons.password_security.controllers.main'
14+
IMPORT = 'odoo.addons.password_security.controllers.main'
1515

1616

1717
class EndTestException(Exception):

password_security/tests/test_res_users.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import time
66

7-
from openerp.tests.common import TransactionCase
7+
from odoo.tests.common import TransactionCase
88

99
from ..exceptions import PassError
1010

0 commit comments

Comments
 (0)