diff --git a/addons/auth_totp/__manifest__.py b/addons/auth_totp/__manifest__.py index e350d36c9b0..dd70ff54d73 100644 --- a/addons/auth_totp/__manifest__.py +++ b/addons/auth_totp/__manifest__.py @@ -14,14 +14,13 @@ Note: logically, two-factor prevents password-based RPC access for users where it is enabled. In order to be able to execute RPC scripts, the user can setup API keys to replace their main password. """, - 'depends': ['web', 'mail'], + 'depends': ['web'], 'category': 'Extra Tools', 'auto_install': True, 'data': [ 'security/security.xml', 'security/ir.model.access.csv', 'data/ir_action_data.xml', - 'data/mail_template_data.xml', 'views/res_users_views.xml', 'views/templates.xml', 'wizard/auth_totp_wizard_views.xml', diff --git a/addons/auth_totp/data/ir_action_data.xml b/addons/auth_totp/data/ir_action_data.xml index 9543556ed08..2dcf86157d7 100644 --- a/addons/auth_totp/data/ir_action_data.xml +++ b/addons/auth_totp/data/ir_action_data.xml @@ -1,18 +1,5 @@ - - - Invite to use two-factor authentication - - - list - code - - action = records.action_totp_invite() - - - - Disable two-factor authentication @@ -25,16 +12,4 @@ - - - - Open two-factor authentication configuration - - code - -user = env.user -action = user.action_open_my_account_settings() - - - diff --git a/addons/auth_totp/models/res_users.py b/addons/auth_totp/models/res_users.py index 8e19092de32..2ec48edf39b 100644 --- a/addons/auth_totp/models/res_users.py +++ b/addons/auth_totp/models/res_users.py @@ -41,16 +41,6 @@ class Users(models.Model): for r, v in zip(self, self.sudo()): r.totp_enabled = bool(v.totp_secret) - def action_open_my_account_settings(self): - action = { - "name": _("Account Security"), - "type": "ir.actions.act_window", - "res_model": "res.users", - "views": [[self.env.ref('auth_totp.res_users_view_form_security').id, "form"]], - "res_id": self.id, - } - return action - def _rpc_api_keys_only(self): # 2FA enabled means we can't allow password-based RPC self.ensure_one() @@ -89,32 +79,6 @@ class Users(models.Model): _logger.info("2FA enable: SUCCESS for %s %r", self, self.login) return True - def get_totp_invite_url(self): - return '/web#action=auth_totp.action_activate_two_factor_authentication' - - def action_totp_invite(self): - invite_template = self.env.ref('auth_totp.mail_template_totp_invite') - users_to_invite = self.sudo().filtered(lambda user: not user.totp_secret) - for user in users_to_invite: - email_values = { - 'email_from': self.env.user.email_formatted, - 'author_id': self.env.user.partner_id.id, - } - invite_template.send_mail(user.id, force_send=True, email_values=email_values, - notif_layout='mail.mail_notification_light') - - # Display a confirmation toaster - return { - 'type': 'ir.actions.client', - 'tag': 'display_notification', - 'params': { - 'type': 'info', - 'sticky': False, - 'message': _("Invitation to use two-factor authentication sent for the following user(s): %s", - ', '.join(users_to_invite.mapped('name'))), - } - } - @check_identity def action_totp_disable(self): logins = ', '.join(map(repr, self.mapped('login'))) diff --git a/addons/auth_totp/views/res_users_views.xml b/addons/auth_totp/views/res_users_views.xml index 5a268addd1e..9ee3e7a328b 100644 --- a/addons/auth_totp/views/res_users_views.xml +++ b/addons/auth_totp/views/res_users_views.xml @@ -31,8 +31,6 @@ disabled="1" type="object" class="fa fa-toggle-off o_auth_2fa_btn disabled" aria-label="Enable 2FA"> - @@ -105,36 +103,4 @@ - - - - users preference: Account Security - res.users - - primary - -
- 0 - 0 - 0 -
-

- - -
-
- $0 -
- - -
-

- -

-
-
- -