From 5d25d0e9270145866fed2e75ee77eec49589925b Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 14 Sep 2020 09:25:36 +0000 Subject: [PATCH] [FIX] portal: don't eagerly load security template There's absolutely no need to load it on every page of the website. It probably doesn't even need to be cached on the JS side given it's used in all of 3 actions of the portal user's security page. Reported by jke. Also remove leftover console.log call while at it. closes odoo/odoo#57636 X-original-commit: 00c1c9a7258cf53f1a40938e3a928151b188de64 Signed-off-by: Xavier Morel (xmo) --- addons/auth_totp_portal/static/src/js/totp_frontend.js | 1 - addons/portal/static/src/js/portal.js | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/auth_totp_portal/static/src/js/totp_frontend.js b/addons/auth_totp_portal/static/src/js/totp_frontend.js index b4644fc77cd..cb249e63d65 100644 --- a/addons/auth_totp_portal/static/src/js/totp_frontend.js +++ b/addons/auth_totp_portal/static/src/js/totp_frontend.js @@ -183,7 +183,6 @@ publicWidget.registry.TOTPButton = publicWidget.Widget.extend({ document.getElementById('totp_wizard_view').textContent, 'application/xhtml+xml' ); - console.log(doc); const xmlBody = doc.querySelector('sheet *'); const [body, , codeInput] = fixupViewBody(xmlBody, record); diff --git a/addons/portal/static/src/js/portal.js b/addons/portal/static/src/js/portal.js index f938521b265..7499a798851 100644 --- a/addons/portal/static/src/js/portal.js +++ b/addons/portal/static/src/js/portal.js @@ -163,8 +163,6 @@ publicWidget.registry.portalSearchPanel = publicWidget.Widget.extend({ }, }); -const tmpl = ajax.loadXML('/portal/static/src/xml/portal_security.xml', qweb); - /** * Wraps an RPC call in a check for the result being an identity check action * descriptor. If no such result is found, just returns the wrapped promise's @@ -184,7 +182,7 @@ function handleCheckIdentity(rpc, wrapped) { return r; } const check_id = r.res_id; - return tmpl.then(() => new Promise((resolve, reject) => { + return ajax.loadXML('/portal/static/src/xml/portal_security.xml', qweb).then(() => new Promise((resolve, reject) => { const d = new Dialog(null, { title: _t("Security Control"), $content: qweb.render('portal.identitycheck'),