From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH pve-manager 1/2] ui: mobile: fix totp login
Date: Thu, 14 Dec 2023 10:55:16 +0100 [thread overview]
Message-ID: <20231214095517.2339898-1-d.csapak@proxmox.com> (raw)
logging in with totp on mobile was broken with these two commits:
pve-manager:
509d7a20 ("mobile ui: implement dummy message box and scrip loader")
and
pve-access-control:
cb64967 ("api: drop old verify_tfa api call")
the pve-manager one overwrote the Ext.MessageBox and Ext.Msg classes and
thus removed the Ext.MessageBox.OKCANCEL constant that represented the
buttons of popup messages (without those no buttons on message boxes
where shown).
This override did not work as intended, as we still showed the message
box by accident, because at that point the Ext.MessageBox was already
initialized (so it was overwritten), but Ext.Msg was not (this happens
later).
and the pve-access-control removed the old tfa verify api (which is now
done via the /access/ticket api)
so to fix that, we have to adapt to the api changes and restore the
stock Ext.MessageBox and Ext.Msg classes by removing the overrides
(i couldn't find where we would need those)
we still cannot handle u2f or recovery methods though
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/mobile/Login.js | 8 ++++++--
www/mobile/Toolkit.js | 5 -----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/www/mobile/Login.js b/www/mobile/Login.js
index 0abc2a14..06c8b3d4 100644
--- a/www/mobile/Login.js
+++ b/www/mobile/Login.js
@@ -35,8 +35,12 @@ Ext.define('PVE.Login', {
message: 'Loading...',
});
Proxmox.Utils.API2Request({
- url: '/api2/extjs/access/tfa',
- params: { response: code },
+ url: '/api2/extjs/access/ticket',
+ params: {
+ username: ticketResponse.username,
+ 'tfa-challenge': ticketResponse.ticket,
+ password: `totp:${code}`
+ },
method: 'POST',
timeout: 5000, // it'll delay both success & failure
success: function(resp, opts) {
diff --git a/www/mobile/Toolkit.js b/www/mobile/Toolkit.js
index c6e4e4a0..7bde24e6 100644
--- a/www/mobile/Toolkit.js
+++ b/www/mobile/Toolkit.js
@@ -7,9 +7,4 @@ Ext.Ajax.setDisableCaching(false);
// do not send '_dc' parameter
Ext.Ajax.disableCaching = false;
-Ext.MessageBox = Ext.Msg = {
- alert: (title, message) => console.warn(title, message),
- show: ({ title, message }) => console.warn(title, message),
-};
-
Ext.Loader.injectScriptElement = (url) => console.warn(`surpressed loading ${url}`);
--
2.30.2
next reply other threads:[~2023-12-14 9:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 9:55 Dominik Csapak [this message]
2023-12-14 9:55 ` [pve-devel] [RFC PATCH pve-manager 2/2] ui: mobile: enable subscription popup Dominik Csapak
2024-04-23 14:40 ` [pve-devel] applied: [RFC PATCH pve-manager 1/2] ui: mobile: fix totp login Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231214095517.2339898-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox