mirror of
https://github.com/bringout/oca-ocb-security.git
synced 2026-04-22 11:52:07 +02:00
19.0 vanilla
This commit is contained in:
parent
20ddc1b4a3
commit
c0efcc53f5
1162 changed files with 125577 additions and 105287 deletions
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="res_config_settings_view_form" model="ir.ui.view">
|
||||
<field name="name">res.config.settings.view.form.inherit.auth_totp_mail_enforce</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="priority" eval="40"/>
|
||||
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//setting[@id='allow_import']" position="before">
|
||||
<setting id="auth_totp_policy" help="Enforce the two-factor authentication by email for employees or for all users (including portal users) if they didn't enable any other two-factor authentication method.">
|
||||
<field name="auth_totp_enforce" />
|
||||
<div class="mt16" invisible="not auth_totp_enforce">
|
||||
<field name="auth_totp_policy" class="o_light_label" widget="radio"/>
|
||||
</div>
|
||||
</setting>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -5,14 +5,19 @@
|
|||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="auth_totp.view_totp_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='action_totp_enable_wizard']" position="after">
|
||||
<button groups="base.group_erp_manager" attrs="{'invisible': "[('id', '=', uid)]"}"
|
||||
name="action_totp_invite" string="Invite to use 2FA" type="object" class="btn btn-secondary"/>
|
||||
<xpath expr="//div[@name='div_action_totp_enable_wizard']" position="inside">
|
||||
<button groups="base.group_erp_manager" invisible="id == uid or totp_enabled"
|
||||
name="action_totp_invite" string="Invite to use 2FA" type="object" class="btn btn-secondary h-100"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='div_action_totp_enable_wizard']/span" position="attributes">
|
||||
<attribute name="class" add="me-2" separator=" "/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- View used when coming from "invite to use 2FA" mail -->
|
||||
<!-- The notebook is overridden to avoid displaying irrelevant data and show
|
||||
only the button to enable the 2FA button. -->
|
||||
<record model="ir.ui.view" id="auth_totp_mail.res_users_view_form">
|
||||
<field name="name">res.users.view.form.auth.totp.mail</field>
|
||||
<field name="model">res.users</field>
|
||||
|
|
@ -24,23 +29,21 @@
|
|||
<attribute name='edit'>0</attribute>
|
||||
<attribute name='delete'>0</attribute>
|
||||
</form>
|
||||
<h1 position="replace"/>
|
||||
<xpath expr="//field[@name='image_1920']" position="replace"/>
|
||||
<notebook position="replace">
|
||||
<header>
|
||||
</header>
|
||||
<sheet>$0</sheet>
|
||||
</notebook>
|
||||
<notebook position="before">
|
||||
<field name="image_1920" widget="image" class="oe_avatar" options="{'zoom': true, 'preview_image':'image_128'}"/>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name" placeholder="Name" required="True" readonly="context.get('from_my_profile', False)"/>
|
||||
</h1>
|
||||
<div class="d-flex mt-3">
|
||||
<div class="col-7 col-sm-6 col-lg-3 d-flex flex-column">
|
||||
<label for="totp_enabled" string="Two-factor Authentication" class="o_form_label"/>
|
||||
<span class="text-muted">
|
||||
Recommended for extra security.
|
||||
</span>
|
||||
</div>
|
||||
<field name="totp_enabled" invisible="1"/> <!-- Required for the visibility of the 2FA buttons. -->
|
||||
<button invisible="totp_enabled" name="action_totp_enable_wizard"
|
||||
type="object" class="btn btn-secondary h-100" string="Enable 2FA" help="Click to enable 2FA."/>
|
||||
<button invisible="not totp_enabled" name="action_totp_enable_wizard"
|
||||
type="object" disabled="1" class="btn btn-secondary h-100 disabled" string="Enable 2FA"/>
|
||||
</div>
|
||||
</notebook>
|
||||
<page name="preferences_page" position="replace"></page>
|
||||
<footer position="replace"/>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<odoo>
|
||||
<template id="auth_totp_mail_form" inherit_id="auth_totp.auth_totp_form">
|
||||
<xpath expr="//form/div[1]" position="attributes">
|
||||
<attribute name="t-if">user._mfa_type() == 'totp'</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//form/div[1]" position="after">
|
||||
<div t-if="user._mfa_type() == 'totp_mail'" class="mb-2 mt-2 text-muted">
|
||||
<i class="fa fa-envelope-o"/>
|
||||
To login, enter below the six-digit authentication code just sent via email to <t t-out="user.email"/>.
|
||||
<br/>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//form[1]" position="after">
|
||||
<form method="POST" t-if="user._mfa_type() == 'totp_mail'">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<input type="hidden" name="send_email" value="1"/>
|
||||
<button type="submit" class="btn btn-secondary btn-block">Re-send email</button>
|
||||
</form>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('border-top')]" position="before">
|
||||
<div class="mb-2" t-if="user._mfa_type() == 'totp_mail'">
|
||||
We strongly recommend enabling the two-factor authentication using an authenticator app to help secure your account.
|
||||
<br/>
|
||||
<a href="https://www.odoo.com/documentation/latest/applications/general/auth/2fa.html" title="Learn More" target="_blank">Learn More</a>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue