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);