mirror of
https://github.com/bringout/oca-ocb-security.git
synced 2026-04-25 02:02:06 +02:00
Initial commit: Security packages
This commit is contained in:
commit
bb469e4763
1399 changed files with 278378 additions and 0 deletions
|
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="res_users_view_search">
|
||||
<field name="name">res.users.view.search.inherit.auth.totp</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_search" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//search" position="inside">
|
||||
<separator/>
|
||||
<filter name="totp_enabled" string="Two-factor authentication Enabled" domain="[('totp_enabled','!=',False)]"/>
|
||||
<filter name="totp_disabled" string="Two-factor authentication Disabled" domain="[('totp_enabled','=',False)]"/>
|
||||
</xpath>
|
||||
</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='preferences']" position="after">
|
||||
<page string="Account Security" name="security" attrs="{'invisible': [('id', '=', False)]}">
|
||||
<field name="totp_enabled" invisible="1"/>
|
||||
<!-- For own user, allow to activate the two-factor Authentication -->
|
||||
<div>
|
||||
<div class="o_horizontal_separator d-flex align-items-center mt-2 mb-4 text-uppercase fw-bolder small">Two-factor Authentication
|
||||
<div attrs="{'invisible': [('totp_enabled', '!=', False)]}">
|
||||
<button attrs="{'invisible': "[('id', '=', uid)]"}" name="action_totp_enable_wizard"
|
||||
disabled="1" type="object" class="fa fa-toggle-off o_auth_2fa_btn disabled" aria-label="Enable 2FA"></button>
|
||||
<button attrs="{'invisible': "[('id', '!=', uid)]"}" name="action_totp_enable_wizard"
|
||||
type="object" class="fa fa-toggle-off o_auth_2fa_btn disabled pe-auto" aria-label="Enable 2FA"></button>
|
||||
</div>
|
||||
<button attrs="{'invisible': [('totp_enabled', '=', False)]}" name="action_totp_disable" type="object"
|
||||
class="fa fa-toggle-on o_auth_2fa_btn text-primary enabled" aria-label="Disable 2FA"></button>
|
||||
</div>
|
||||
<span attrs="{'invisible': [('totp_enabled', '!=', False)]}" class="text-muted">
|
||||
Two-factor Authentication ("2FA") is a system of double authentication.
|
||||
The first one is done with your password and the second one with a code you get from a dedicated mobile app.
|
||||
Popular ones include Authy, Google Authenticator or the Microsoft Authenticator.
|
||||
<a href="https://www.odoo.com/documentation/16.0/applications/general/auth/2fa.html" title="Learn More" target="_blank">
|
||||
<i title="Documentation" class="fa fa-fw o_button_icon fa-info-circle"></i>
|
||||
Learn More
|
||||
</a>
|
||||
</span>
|
||||
<span attrs="{'invisible': [('totp_enabled', '=', False)]}" class="text-muted">This account is protected!</span>
|
||||
</div>
|
||||
<group name="auth_devices" string="Trusted Devices" attrs="{'invisible': [('totp_trusted_device_ids', '=', [])]}">
|
||||
<div colspan="2">
|
||||
<field name="totp_trusted_device_ids" nolabel="1" colspan="4" readonly="1">
|
||||
<tree create="false" delete="false">
|
||||
<field name="name" string="Device"/>
|
||||
<field name="create_date" string="Added On"/>
|
||||
<button type="object" name="remove"
|
||||
title="Revoke" icon="fa-trash"/>
|
||||
</tree>
|
||||
</field>
|
||||
<button name="revoke_all_devices" string="Revoke All" type="object" class="btn btn-secondary"
|
||||
confirm="Are you sure? The user may be asked to enter two-factor codes again on those devices"/>
|
||||
</div>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_totp_field">
|
||||
<field name="name">users preference: totp</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="auth" position="after">
|
||||
<field name="totp_enabled" invisible="1"/>
|
||||
<div>
|
||||
<div class="o_horizontal_separator mt-2 mb-4 text-uppercase fw-bolder small">Two-factor Authentication
|
||||
<button attrs="{'invisible': [('totp_enabled', '!=', False)]}" name="action_totp_enable_wizard"
|
||||
type="object" class="fa fa-toggle-off o_auth_2fa_btn" aria-label="Enable 2FA"/>
|
||||
<button attrs="{'invisible': [('totp_enabled', '=', False)]}" name="action_totp_disable"
|
||||
type="object" class="fa fa-toggle-on o_auth_2fa_btn text-primary" aria-label="Disable 2FA"/>
|
||||
</div>
|
||||
<span attrs="{'invisible': [('totp_enabled', '=', False)]}" class="text-muted">Your account is protected!</span>
|
||||
<span attrs="{'invisible': [('totp_enabled', '!=', False)]}" class="text-muted">
|
||||
Two-factor Authentication ("2FA") is a system of double authentication.
|
||||
The first one is done with your password and the second one with a code you get from a dedicated mobile app.
|
||||
Popular ones include Authy, Google Authenticator or the Microsoft Authenticator.
|
||||
<a href="https://www.odoo.com/documentation/16.0/applications/general/auth/2fa.html" title="Learn More" target="_blank">
|
||||
<i title="Documentation" class="fa fa-fw o_button_icon fa-info-circle"></i>
|
||||
Learn More
|
||||
</a>
|
||||
</span>
|
||||
<group name="auth_devices" string="Trusted Devices" attrs="{'invisible': [('totp_trusted_device_ids', '=', [])]}">
|
||||
<div colspan="2">
|
||||
<field name="totp_trusted_device_ids" nolabel="1" colspan="4" readonly="1">
|
||||
<tree create="false" delete="false">
|
||||
<field name="name" string="Device"/>
|
||||
<field name="create_date" string="Added On"/>
|
||||
<button type="object" name="remove"
|
||||
title="Revoke" icon="fa-trash"/>
|
||||
</tree>
|
||||
</field>
|
||||
<button name="revoke_all_devices" string="Revoke All" type="object" class="btn btn-secondary"
|
||||
confirm="Are you sure? You may be asked to enter two-factor codes again on those devices"/>
|
||||
</div>
|
||||
</group>
|
||||
</div>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<odoo>
|
||||
|
||||
<template id="auth_totp_form" name="Two-Factor Authentication">
|
||||
<t t-call="web.login_layout">
|
||||
<t t-set="disable_footer">1</t>
|
||||
<div class="oe_login_form">
|
||||
<h5 class="card-title">Two-factor Authentication</h5>
|
||||
<form method="POST" action="" class="">
|
||||
<div class="mb-2 mt-2 text-muted">
|
||||
To login, enter below the six-digit authentication code provided by your Authenticator app.
|
||||
<br/>
|
||||
<a href="https://www.odoo.com/documentation/16.0/applications/general/auth/2fa.html"
|
||||
title="Learn More" target="_blank">Learn More</a>
|
||||
</div>
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<input type="hidden" name="redirect" t-att-value="redirect"/>
|
||||
<div class="mb-3">
|
||||
<label class="fw-bold" for="totp_token">Authentication Code</label>
|
||||
<input id="totp_token" name="totp_token" class="form-control mb-2"
|
||||
autocomplete="off" inputmode="numeric" autofocus="autofocus" required="required" placeholder="e.g. 123456"/>
|
||||
</div>
|
||||
<div class="text-center py-2 border-top">
|
||||
<p class="alert alert-danger" t-if="error" role="alert">
|
||||
<t t-esc="error"/>
|
||||
</p>
|
||||
<div class="mb-2 mt-2 text-muted">
|
||||
<input type="checkbox" name="remember" id="switch-remember" value="1"/>
|
||||
<label for="switch-remember">Don't ask again on this device</label>
|
||||
</div>
|
||||
<div t-attf-class="clearfix oe_login_buttons text-center d-grid mb-1">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Log in
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="POST" action="/web/session/logout">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<div class="w-100 text-center">
|
||||
<button type="submit" class="btn btn-link btn-sm mb-2">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue