This commit is contained in:
Roland Gruber 2020-01-10 20:06:24 +01:00
parent 3ac7ae668b
commit 4e329f1f55
3 changed files with 10 additions and 4 deletions

View File

@ -1615,10 +1615,11 @@ window.lam.webauthn.removeDevice = function(event) {
* Removes a user's own webauthn device.
*
* @param event click event
* @param isSelfService run in self service or admin context
*/
window.lam.webauthn.removeOwnDevice = function(event) {
window.lam.webauthn.removeOwnDevice = function(event, isSelfService) {
event.preventDefault();
const element = jQuery(event.target);
const element = jQuery(event.currentTarget);
const successCallback = function () {
const form = jQuery("#webauthnform");
jQuery('<input>').attr({
@ -1628,7 +1629,11 @@ window.lam.webauthn.removeOwnDevice = function(event) {
}).appendTo(form);
form.submit();
};
window.lam.webauthn.removeDeviceDialog(element, 'webauthnOwnDevices', successCallback);
let action = 'webauthnOwnDevices';
if (isSelfService) {
action = action + '&selfservice=true&module=webauthn&scope=user';
}
window.lam.webauthn.removeDeviceDialog(element, action, successCallback);
return false;
}

View File

@ -92,6 +92,7 @@ class Ajax {
$module = new $_GET['module']($_GET['scope']);
$module->handleAjaxRequest();
}
die();
}
if (!isset($_GET['function'])) {
die();

View File

@ -115,7 +115,7 @@ else {
$delButton->addDataAttribute('dialogtitle', _('Remove device'));
$delButton->addDataAttribute('oktext', _('Ok'));
$delButton->addDataAttribute('canceltext', _('Cancel'));
$delButton->setOnClick('window.lam.webauthn.removeOwnDevice(event);');
$delButton->setOnClick('window.lam.webauthn.removeOwnDevice(event, false);');
$data[] = array(
new htmlOutputText(date('Y-m-d H:i:s', $result['registrationTime'])),
new htmlOutputText(date('Y-m-d H:i:s', $result['lastUseTime'])),