Skip to content

Commit a6c26f7

Browse files
committed
[FIX] auth_sms: compatibility with auth_totp* modules
1 parent cab2019 commit a6c26f7

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

auth_sms/models/res_users.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,10 @@ def _auth_sms_check_rate_limit(self):
140140
<= rate_limit_limit
141141
)
142142

143-
# def _register_hook(self):
144-
# # don't log our exceptions during RPC dispatch
145-
# if AccessDeniedNoSmsCode not in http.NO_POSTMORTEM:
146-
# http.NO_POSTMORTEM = tuple(
147-
# list(http.NO_POSTMORTEM)
148-
# + [
149-
# AccessDeniedNoSmsCode,
150-
# AccessDeniedWrongSmsCode,
151-
# ],
152-
# )
153-
# return super(ResUsers, self)._register_hook()
143+
def _mfa_type(self):
144+
"""If auth_sms enabled, disable other totp methods."""
145+
result = super()._mfa_type()
146+
if len(self) != 1 or not self.auth_sms_enabled:
147+
return result
148+
# If we get here, we have one user record that is enabled for sms auth.
149+
return "auth_sms"

auth_sms_auth_signup/tests/test_auth_sms_auth_signup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright 2019 Therp BV <https://therp.nl>
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
3-
from mock import patch
3+
from unittest.mock import patch
44

55
from odoo.addons.auth_sms.tests.common import Common
66

0 commit comments

Comments
 (0)