summaryrefslogtreecommitdiff
path: root/addons/auth_totp_portal/views
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/auth_totp_portal/views
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/auth_totp_portal/views')
-rw-r--r--addons/auth_totp_portal/views/templates.xml48
1 files changed, 48 insertions, 0 deletions
diff --git a/addons/auth_totp_portal/views/templates.xml b/addons/auth_totp_portal/views/templates.xml
new file mode 100644
index 00000000..48120eb7
--- /dev/null
+++ b/addons/auth_totp_portal/views/templates.xml
@@ -0,0 +1,48 @@
+<odoo>
+ <template id="auth_totp_frontend" name="TOTP frontend (portal)" inherit_id="portal.assets_frontend">
+ <xpath expr="." position="inside">
+ <script type="application/javascript"
+ src="/auth_totp_portal/static/src/js/totp_frontend.js"/>
+ </xpath>
+ </template>
+ <template id="assets_tests" inherit_id="web.assets_tests">
+ <xpath expr="." position="inside">
+ <script type="text/javascript" src="/auth_totp_portal/static/tests/totp_portal.js"></script>
+ </xpath>
+ </template>
+
+ <template id="totp_portal_hook" name="TOTP Portal hook" inherit_id="portal.portal_my_security">
+ <xpath expr="//div[hasclass('o_portal_security_body')]">
+ <!--
+ portal users don't have access to non-qweb views anymore, so
+ embed the target view as a *data island* of sorts, a JSON embed
+ of the fields_view_get could have been nice but at 14k it'd be a
+ bit ridiculous
+ -->
+ <div class="d-none" id="totp_wizard_view">
+ <t t-esc="env.ref('auth_totp.view_totp_wizard').sudo().read_combined(['arch'])['arch']"/>
+ </div>
+ <section>
+ <h3>Two-factor authentication</h3>
+ <t t-if="not user_id.totp_enabled">
+ <div class="alert alert-secondary" role="status">
+ <i class="fa fa-warning"/>
+ Two-factor authentication not enabled
+ </div>
+ <button type="button" class="btn btn-secondary" id="auth_totp_portal_enable">
+ Enable two-factor authentication
+ </button>
+ </t>
+ <t t-else="">
+ <span class="text-success">
+ <i class="fa fa-check-circle"/>
+ Two-factor authentication enabled
+ </span>
+ <button type="button" class="btn btn-link" id="auth_totp_portal_disable">
+ (Disable two-factor authentication)
+ </button>
+ </t>
+ </section>
+ </xpath>
+ </template>
+</odoo>