Browse Source
[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
pull/579/head
Dave Lasley
8 years ago
No known key found for this signature in database
GPG Key ID: 7DDBA4BA81B934CF
10 changed files with
27 additions and
17 deletions
password_security/README.rst
password_security/__manifest__.py
password_security/controllers/main.py
password_security/exceptions.py
password_security/models/res_company.py
password_security/models/res_users.py
password_security/models/res_users_pass_history.py
password_security/tests/test_password_security_home.py
password_security/tests/test_password_security_session.py
password_security/tests/test_res_users.py
@ -47,6 +47,16 @@ These are defined at the company level:
password_minimum 24 Amount of hours that must pass until another reset
===================== ======= ===================================================
Usage
=====
Configure using above instructions for each company that should have password
security mandates.
.. image :: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
Known Issues / Roadmap
======================
@ -5,7 +5,7 @@
' name ' : ' Password Security ' ,
" summary " : " Allow admin to set password security requirements. " ,
' version ' : ' 9.0.1.0.2 ' ,
' version ' : ' 10.0.1.0.0 ' ,
' author ' : " LasLabs, Odoo Community Association (OCA) " ,
' category ' : ' Base ' ,
' depends ' : [
@ -19,5 +19,5 @@
' security/ir.model.access.csv ' ,
' security/res_users_pass_history.xml ' ,
] ,
' installable ' : Fals e,
' installable ' : Tru e,
}
@ -4,10 +4,10 @@
import operator
from openerp import http
from openerp .http import request
from openerp .addons.auth_signup.controllers.main import AuthSignupHome
from openerp .addons.web.controllers.main import ensure_db , Session
from odoo import http
from odoo .http import request
from odoo .addons.auth_signup.controllers.main import AuthSignupHome
from odoo .addons.web.controllers.main import ensure_db , Session
from ..exceptions import PassError
@ -2,7 +2,7 @@
# Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from openerp .exceptions import Warning as UserError
from odoo .exceptions import Warning as UserError
class PassError ( UserError ) :
@ -2,7 +2,7 @@
# Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from openerp import models , fields
from odoo import models , fields
class ResCompany ( models . Model ) :
@ -6,7 +6,7 @@ import re
from datetime import datetime , timedelta
from openerp import api , fields , models , _
from odoo import api , fields , models , _
from ..exceptions import PassError
@ -129,7 +129,7 @@ class ResUsers(models.Model):
""" It validates proposed password against existing history
: raises : PassError on reused password
"""
crypt = self . _crypt_context ( ) [ 0 ]
crypt = self . _crypt_context ( )
for rec_id in self :
recent_passes = rec_id . company_id . password_history
if recent_passes < 0 :
@ -2,7 +2,7 @@
# Copyright 2016 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from openerp import fields , models
from odoo import fields , models
class ResUsersPassHistory ( models . Model ) :
@ -6,13 +6,13 @@ import mock
from contextlib import contextmanager
from openerp .tests.common import TransactionCase
from openerp .http import Response
from odoo .tests.common import TransactionCase
from odoo .http import Response
from ..controllers import main
IMPORT = ' openerp .addons.password_security.controllers.main '
IMPORT = ' odoo .addons.password_security.controllers.main '
class EndTestException ( Exception ) :
@ -6,12 +6,12 @@ import mock
from contextlib import contextmanager
from openerp .tests.common import TransactionCase
from odoo .tests.common import TransactionCase
from ..controllers import main
IMPORT = ' openerp .addons.password_security.controllers.main '
IMPORT = ' odoo .addons.password_security.controllers.main '
class EndTestException ( Exception ) :
@ -4,7 +4,7 @@
import time
from openerp .tests.common import TransactionCase
from odoo .tests.common import TransactionCase
from ..exceptions import PassError