Skip to content

Commit

Permalink
[MIG] Module migrated in v14.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandresh-SerpentCS authored and Herqs committed Mar 25, 2022
1 parent 3581ce7 commit 8082d72
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
10 changes: 5 additions & 5 deletions auth_user_case_insensitive/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Case Insensitive Logins
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
:target: https://github.com/OCA/server-auth/tree/13.0/auth_user_case_insensitive
:target: https://github.com/OCA/server-auth/tree/14.0/auth_user_case_insensitive
:alt: OCA/server-auth
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-auth-13-0/server-auth-13-0-auth_user_case_insensitive
:target: https://translation.odoo-community.org/projects/server-auth-14-0/server-auth-14-0-auth_user_case_insensitive
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/251/13.0
:target: https://runbot.odoo-community.org/runbot/251/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -54,7 +54,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_user_case_insensitive%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_user_case_insensitive%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -87,6 +87,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/13.0/auth_user_case_insensitive>`_ project on GitHub.
This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/14.0/auth_user_case_insensitive>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions auth_user_case_insensitive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import models
Expand Down
3 changes: 2 additions & 1 deletion auth_user_case_insensitive/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Case Insensitive Logins",
"summary": "Makes the user login field case insensitive",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"category": "Authentication",
"website": "https://github.com/OCA/server-auth",
"author": "LasLabs, Odoo Community Association (OCA)",
Expand Down
1 change: 1 addition & 0 deletions auth_user_case_insensitive/hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import _
Expand Down
1 change: 1 addition & 0 deletions auth_user_case_insensitive/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import res_users
11 changes: 7 additions & 4 deletions auth_user_case_insensitive/models/res_users.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models
Expand All @@ -11,11 +12,13 @@ class ResUsers(models.Model):
login = fields.Char(help="Used to log into the system. Case insensitive.")

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

@api.model_create_multi
def create(self, vals_list):
Expand Down
1 change: 1 addition & 0 deletions auth_user_case_insensitive/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import test_res_users
6 changes: 5 additions & 1 deletion auth_user_case_insensitive/tests/test_res_users.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import api, registry
Expand Down Expand Up @@ -50,7 +51,10 @@ def test_login_login_is_lowercased(self):
self.env.cr.commit()
with mute_logger("odoo.addons.auth_ldap.models.res_company_ldap"):
res_id = self.model_obj._login(
self.env.registry.db_name, self.login.upper(), "password"
self.env.registry.db_name,
self.login.upper(),
"password",
{"interactive": True},
)
# Now clean up our mess to preserve idempotence
with api.Environment.manage():
Expand Down

0 comments on commit 8082d72

Please sign in to comment.