Skip to content

Commit

Permalink
[MIG] auth_user_case_insensitive: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
karizma committed Oct 15, 2024
1 parent 4c697fc commit a460a03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion auth_user_case_insensitive/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Case Insensitive Logins",
"summary": "Makes the user login field case insensitive",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"category": "Authentication",
"website": "https://github.com/OCA/server-auth",
"author": "LasLabs, Odoo Community Association (OCA)",
Expand Down
8 changes: 3 additions & 5 deletions auth_user_case_insensitive/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
class ResUsers(models.Model):
_inherit = "res.users"

login = fields.Char(help="Used to log into the system. Case insensitive.")

@classmethod
def _login(cls, db, login, password, user_agent_env):
def _login(cls, db, credential, user_agent_env):
"""Overload _login to lowercase the `login` before passing to the
super."""
login = login.lower()
return super()._login(db, login, password, user_agent_env=user_agent_env)
credential['credential'] = credential['login'].lower()
return super()._login(db, credential, user_agent_env=user_agent_env)

@api.model_create_multi
def create(self, vals_list):
Expand Down

0 comments on commit a460a03

Please sign in to comment.