| 1 |
<odoo> |
| 2 |
<template id="totp_portal_hook" name="TOTP Portal hook" inherit_id="portal.portal_my_security"> |
| 3 |
<xpath expr="//section[@name='portal_change_password']" position="after"> |
| 4 |
<!-- |
| 5 |
portal users don't have access to non-qweb views anymore, so |
| 6 |
embed the target view as a *data island* of sorts, a JSON embed |
| 7 |
of the fields_view_get could have been nice but at 14k it'd be a |
| 8 |
bit ridiculous |
| 9 |
--> |
| 10 |
<div class="d-none" id="totp_wizard_view"> |
| 11 |
<t t-esc="env.ref('auth_totp.view_totp_wizard').sudo().get_combined_arch()"/> |
| 12 |
</div> |
| 13 |
<section> |
| 14 |
<h4> |
| 15 |
Two-factor authentication |
| 16 |
<a href="https://www.odoo.com/documentation/latest/applications/general/auth/2fa.html" target="_blank"> |
| 17 |
<i title="Documentation" class="fa fa-fw o_button_icon fa-info-circle"></i> |
| 18 |
</a> |
| 19 |
</h4> |
| 20 |
<t t-if="not user_id.totp_enabled"> |
| 21 |
<div class="alert alert-secondary" role="status"> |
| 22 |
<i class="fa fa-warning"/> |
| 23 |
Two-factor authentication not enabled |
| 24 |
</div> |
| 25 |
<button type="button" class="btn btn-light" id="auth_totp_portal_enable"> |
| 26 |
Enable two-factor authentication |
| 27 |
</button> |
| 28 |
</t> |
| 29 |
<t t-else=""> |
| 30 |
<span class="text-success"> |
| 31 |
<i class="fa fa-check-circle"/> |
| 32 |
Two-factor authentication enabled |
| 33 |
</span> |
| 34 |
<button type="button" class="btn btn-link" id="auth_totp_portal_disable"> |
| 35 |
(Disable two-factor authentication) |
| 36 |
</button> |
| 37 |
<t t-if="len(user_id.totp_trusted_device_ids)"> |
| 38 |
<table class="table o_main_table"> |
| 39 |
<thead> |
| 40 |
<tr> |
| 41 |
<th><strong>Trusted Device</strong></th> |
| 42 |
<th><strong>Added On</strong></th> |
| 43 |
</tr> |
| 44 |
</thead> |
| 45 |
<tbody> |
| 46 |
<tr t-foreach="user_id.totp_trusted_device_ids" t-as="td"> |
| 47 |
<td> |
| 48 |
<span t-field="td.name"/> |
| 49 |
</td> |
| 50 |
<td> |
| 51 |
<span t-field="td.create_date"/> |
| 52 |
</td> |
| 53 |
<td> |
| 54 |
<i class="fa fa-trash text-danger" type="button" t-att-id="td.id"/> |
| 55 |
</td> |
| 56 |
</tr> |
| 57 |
</tbody> |
| 58 |
</table> |
| 59 |
<button class="btn btn-primary" type="button" id="auth_totp_portal_revoke_all_devices"> |
| 60 |
Revoke All |
| 61 |
</button> |
| 62 |
</t> |
| 63 |
</t> |
| 64 |
</section> |
| 65 |
</xpath> |
| 66 |
</template> |
| 67 |
</odoo> |