Skip to content

Commit

Permalink
[MIG] password_security: explicit super()
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Apr 18, 2023
1 parent 64f98c7 commit da84bfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions password_security/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def do_signup(self, qcontext):
password = qcontext.get("password")
user = request.env.user
user._check_password(password)
return super().do_signup(qcontext)
return super(PasswordSecurityHome, self).do_signup(qcontext)

@http.route()
def web_login(self, *args, **kw):
ensure_db()
response = super().web_login(*args, **kw)
response = super(PasswordSecurityHome, self).web_login(*args, **kw)
if not request.params.get("login_success"):
return response
# Now, I'm an authenticated user
Expand All @@ -48,7 +48,7 @@ def web_auth_signup(self, *args, **kw):
raise BadRequest from None # HTTPError: 400 Client Error: BAD REQUEST

try:
return super().web_auth_signup(*args, **kw)
return super(PasswordSecurityHome, self).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()
Expand Down
10 changes: 5 additions & 5 deletions password_security/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class ResUsers(models.Model):
def write(self, vals):
if vals.get("password"):
vals["password_write_date"] = fields.Datetime.now()
return super().write(vals)
return super(ResUsers, self).write(vals)

@api.model
def get_password_policy(self):
data = super().get_password_policy()
data = super(ResUsers, self).get_password_policy()
company_id = self.env.user.company_id
data.update(
{
Expand All @@ -60,7 +60,7 @@ def get_password_policy(self):
return data

def _check_password_policy(self, passwords):
result = super()._check_password_policy(passwords)
result = super(ResUsers, self)._check_password_policy(passwords)

for password in passwords:
if not password:
Expand Down Expand Up @@ -202,7 +202,7 @@ def _check_password_history(self, password):

def _set_encrypted_password(self, uid, pw):
"""It saves password crypt history for history rules"""
res = super()._set_encrypted_password(uid, pw)
res = super(ResUsers, self)._set_encrypted_password(uid, pw)

self.write({"password_history_ids": [(0, 0, {"password_crypt": pw})]})
return res
Expand All @@ -215,4 +215,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().action_reset_password()
return super(ResUsers, self).action_reset_password()

0 comments on commit da84bfd

Please sign in to comment.