summaryrefslogtreecommitdiff
path: root/addons/auth_totp_portal/views/templates.xml
blob: 48120eb7f525982be0572363cb1870ad0ca52a95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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>