summaryrefslogtreecommitdiff
path: root/addons/auth_totp
diff options
context:
space:
mode:
Diffstat (limited to 'addons/auth_totp')
-rw-r--r--addons/auth_totp/models/res_users.py2
-rw-r--r--addons/auth_totp/views/user_preferences.xml27
2 files changed, 28 insertions, 1 deletions
diff --git a/addons/auth_totp/models/res_users.py b/addons/auth_totp/models/res_users.py
index 5fd8b4e4acd..070e51a3590 100644
--- a/addons/auth_totp/models/res_users.py
+++ b/addons/auth_totp/models/res_users.py
@@ -23,7 +23,7 @@ class Users(models.Model):
_inherit = 'res.users'
totp_secret = fields.Char(copy=False, groups=fields.NO_ACCESS)
- totp_enabled = fields.Boolean(string="TOTP enabled", compute='_compute_totp_enabled')
+ totp_enabled = fields.Boolean(string="Two-factor authentication", compute='_compute_totp_enabled')
def __init__(self, pool, cr):
init_res = super().__init__(pool, cr)
diff --git a/addons/auth_totp/views/user_preferences.xml b/addons/auth_totp/views/user_preferences.xml
index 5bc86194158..004379ddc54 100644
--- a/addons/auth_totp/views/user_preferences.xml
+++ b/addons/auth_totp/views/user_preferences.xml
@@ -9,6 +9,33 @@
</tree>
</field>
</record>
+ <record model="ir.ui.view" id="view_totp_form">
+ <field name="name">user form: add totp status</field>
+ <field name="model">res.users</field>
+ <field name="inherit_id" ref="base.view_users_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//page[@name='references']/group[1]" position="before">
+ <field name="totp_enabled" invisible="1"/>
+ <group attrs="{'invisible': [('totp_enabled', '!=', False)]}">
+ <div>
+ <span class="alert alert-info" role="status">
+ <i class="fa fa-warning"/>
+ Two-factor authentication not enabled
+ </span>
+ </div>
+ </group>
+ <group attrs="{'invisible': [('totp_enabled', '=', False)]}">
+ <div>
+ <span class="text-success">
+ <i class="fa fa-check-circle"/>
+ Two-factor authentication enabled
+ </span>
+ </div>
+ </group>
+ </xpath>
+ </field>
+ </record>
+
<record model="ir.actions.server" id="action_disable_totp">
<field name="name">Disable TOTP on users</field>
<field name="model_id" ref="base.model_res_users"/>