From 36c3f7a881c58017e83c18b0270f10bf9cca15c4 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Mon, 27 Jul 2026 16:50:33 -0400 Subject: [PATCH] Remove native confirm() calls in revokeToken/rotateToken Native confirm() blocks browser automation entirely (found live, mid browser-test of the app.messages/app.modal adoption, on sso-manager-node's equivalent flow). Both functions already receive btn, whose .closest('.card') is already used for the error path, so app.messages.confirm targets the same card. Co-Authored-By: Claude Sonnet 5 --- nodejs/views/profile.ejs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nodejs/views/profile.ejs b/nodejs/views/profile.ejs index 70d4ffb..0414cb0 100644 --- a/nodejs/views/profile.ejs +++ b/nodejs/views/profile.ejs @@ -178,16 +178,18 @@ }); } - function revokeToken(id, name, btn){ - if(!confirm('Revoke API token "' + name + '"? It stops working immediately.')) return; + async function revokeToken(id, name, btn){ + const ok = await app.messages.confirm('Revoke API token "' + name + '"? It stops working immediately.', $(btn).closest('.card'), 'danger'); + if(!ok) return; app.apiToken.remove({id: id}, function(error, data){ if(error) return app.messages.action(error, $(btn).closest('.card'), 'danger'); $.scope.apiTokenCard.remove('id', id); }); } - function rotateToken(id, name, btn){ - if(!confirm('Rotate API token "' + name + '"? The old token stops working immediately.')) return; + async function rotateToken(id, name, btn){ + const ok = await app.messages.confirm('Rotate API token "' + name + '"? The old token stops working immediately.', $(btn).closest('.card'), 'warning'); + if(!ok) return; app.apiToken.rotate({id: id}, function(error, data){ if(error) return app.messages.action(error, $(btn).closest('.card'), 'danger'); showSecret(data.token);