diff --git a/password_security/__manifest__.py b/password_security/__manifest__.py index 6b1391d6c..237250eed 100644 --- a/password_security/__manifest__.py +++ b/password_security/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Password Security", "summary": "Allow admin to set password security requirements.", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "author": "LasLabs, " "Onestein, " "Kaushal Prajapati, " diff --git a/password_security/controllers/main.py b/password_security/controllers/main.py index 1736ca354..11d076a0e 100644 --- a/password_security/controllers/main.py +++ b/password_security/controllers/main.py @@ -19,12 +19,12 @@ def do_signup(self, qcontext): password = qcontext.get("password") user = request.env.user user._check_password(password) - return super(PasswordSecurityHome, self).do_signup(qcontext) + return super().do_signup(qcontext) @http.route() def web_login(self, *args, **kw): ensure_db() - response = super(PasswordSecurityHome, self).web_login(*args, **kw) + response = super().web_login(*args, **kw) if not request.params.get("login_success"): return response if not request.env.user: @@ -50,7 +50,7 @@ def web_auth_signup(self, *args, **kw): raise BadRequest from None # HTTPError: 400 Client Error: BAD REQUEST try: - return super(PasswordSecurityHome, self).web_auth_signup(*args, **kw) + return super().web_auth_signup(*args, **kw) except Exception as e: # Here we catch any generic exception since UserError is already # handled in parent method web_auth_signup() diff --git a/password_security/migrations/16.0.1.0.0/pre-migration.py b/password_security/migrations/16.0.1.0.0/pre-migration.py deleted file mode 100644 index 67c9d1f7a..000000000 --- a/password_security/migrations/16.0.1.0.0/pre-migration.py +++ /dev/null @@ -1,24 +0,0 @@ -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). - -import logging - -from odoo import SUPERUSER_ID, api - - -def migrate(cr, version): - if not version: - return - logger = logging.getLogger(__name__) - logger.info( - "Password Security: migration of the password_length " - "value into standard minlength field." - ) - env = api.Environment(cr, SUPERUSER_ID, {}) - if env["res.company"]._fields.get("password_length"): - password_length_list = env["res.company"].search([]).mapped("password_length") - ICP = env["ir.config_parameter"] - minlength = ICP.get_param("auth_password_policy.minlength") - minlength = int(minlength) if minlength else 0 - ICP.set_param( - "auth_password_policy.minlength", max(minlength, *password_length_list) - ) diff --git a/password_security/models/res_users.py b/password_security/models/res_users.py index 8a5213e4b..c080223f2 100644 --- a/password_security/models/res_users.py +++ b/password_security/models/res_users.py @@ -30,11 +30,11 @@ class ResUsers(models.Model): def write(self, vals): if vals.get("password"): vals["password_write_date"] = fields.Datetime.now() - return super(ResUsers, self).write(vals) + return super().write(vals) @api.model def get_password_policy(self): - data = super(ResUsers, self).get_password_policy() + data = super().get_password_policy() company_id = self.env.user.company_id data.update( { @@ -47,7 +47,7 @@ def get_password_policy(self): return data def _check_password_policy(self, passwords): - result = super(ResUsers, self)._check_password_policy(passwords) + result = super()._check_password_policy(passwords) for password in passwords: if not password: @@ -178,7 +178,7 @@ def _check_password_history(self, password): def _set_encrypted_password(self, uid, pw): """It saves password crypt history for history rules""" - res = super(ResUsers, self)._set_encrypted_password(uid, pw) + res = super()._set_encrypted_password(uid, pw) self.env["res.users.pass.history"].create( { @@ -196,4 +196,4 @@ def action_reset_password(self): if not self.env.user._is_admin(): users = self.filtered(lambda user: user.active) users._validate_pass_reset() - return super(ResUsers, self).action_reset_password() + return super().action_reset_password() diff --git a/password_security/tests/test_res_users.py b/password_security/tests/test_res_users.py index b4cdc55e6..8d8ea5714 100644 --- a/password_security/tests/test_res_users.py +++ b/password_security/tests/test_res_users.py @@ -9,7 +9,7 @@ class TestResUsers(TransactionCase): def setUp(self): - super(TestResUsers, self).setUp() + super().setUp() self.login = "foslabs@example.com" self.partner_vals = { "name": "Partner", diff --git a/password_security/views/res_config_settings_views.xml b/password_security/views/res_config_settings_views.xml index 4fb6816d2..c86134ab1 100644 --- a/password_security/views/res_config_settings_views.xml +++ b/password_security/views/res_config_settings_views.xml @@ -12,46 +12,27 @@ ref="auth_password_policy.res_config_settings_view_form" /> - - - 1 - - - - - password_policy - - - - - - - - - - - - - oe_inline + + - - + + +