diff --git a/auth_admin_passkey/README.rst b/auth_admin_passkey/README.rst index 16495b47da..59293d14f5 100644 --- a/auth_admin_passkey/README.rst +++ b/auth_admin_passkey/README.rst @@ -63,6 +63,8 @@ following keys in your ``odoo.cfg`` configuration file. - ``auth_admin_passkey_sysadmin_lang``. the language (exemple en_US), used for the mail sent to the System Administrator. If not set, the language of the SUPERUSER_ID user will be used. +- ``auth_admin_passkey_ignore_totp`` (default False), if enabled, then + 2FA will be ignored. **typical Dev / Test configuration section** diff --git a/auth_admin_passkey/models/res_users.py b/auth_admin_passkey/models/res_users.py index e29aa1b59c..db5a2fb5e5 100644 --- a/auth_admin_passkey/models/res_users.py +++ b/auth_admin_passkey/models/res_users.py @@ -8,6 +8,7 @@ from odoo import SUPERUSER_ID, _, api, exceptions, models from odoo.tools import config +from odoo.http import request logger = logging.getLogger(__name__) @@ -74,6 +75,12 @@ def _check_credentials(self, password, env): password = hashlib.sha512(password.encode()).hexdigest() if password and file_password == password: + request.session['ignore_totp'] = config.get("auth_admin_passkey_ignore_totp", False) self._send_email_passkey(users[0]) else: raise + + def _mfa_url(self): + if request.session.get('ignore_totp'): + return None + return super()._mfa_url() diff --git a/auth_admin_passkey/readme/CONFIGURE.md b/auth_admin_passkey/readme/CONFIGURE.md index 5ba5ff98bb..4827079ef4 100644 --- a/auth_admin_passkey/readme/CONFIGURE.md +++ b/auth_admin_passkey/readme/CONFIGURE.md @@ -15,6 +15,8 @@ following keys in your `odoo.cfg` configuration file. - `auth_admin_passkey_sysadmin_lang`. the language (exemple en_US), used for the mail sent to the System Administrator. If not set, the language of the SUPERUSER_ID user will be used. +- `auth_admin_passkey_ignore_totp` (default False), if enabled, then 2FA + will be ignored. **typical Dev / Test configuration section** diff --git a/auth_admin_passkey/static/description/index.html b/auth_admin_passkey/static/description/index.html index f5c1912885..8489d2917e 100644 --- a/auth_admin_passkey/static/description/index.html +++ b/auth_admin_passkey/static/description/index.html @@ -412,6 +412,8 @@
typical Dev / Test configuration section
No keys to add.