From ccd010cf6126a4dadd7dfc429e8007e0d3e1460d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Tue, 6 Jan 2026 16:32:17 +0100 Subject: [PATCH] [FIX] auth_oauth_autologin: compatibility with auth_totp The auth_totp URL is /web/login/totp. Before this commit it erroneously triggered the autologin redirect. --- .../static/src/js/web_login.esm.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/auth_oauth_autologin/static/src/js/web_login.esm.js b/auth_oauth_autologin/static/src/js/web_login.esm.js index e58bc5298a..2ba955c2ca 100644 --- a/auth_oauth_autologin/static/src/js/web_login.esm.js +++ b/auth_oauth_autologin/static/src/js/web_login.esm.js @@ -12,14 +12,15 @@ publicWidget.registry.login.include({ start: async function () { const def = this._super.apply(this, arguments); let url = window.location.href; - if (url.includes("/web/login")) { + const parsed_url = new URL(url); + if (parsed_url.pathname === "/web/login") { url = url.replace("/web/login", "/web"); - } - this._result = await this._rpc("/auth/auto_login_redirect_link", { - redirect: url, - }); - if (this._result) { - window.location = this._result; + this._result = await this._rpc("/auth/auto_login_redirect_link", { + redirect: url, + }); + if (this._result) { + window.location = this._result; + } } return def; },