'; echo "
'; echo ''; include_once __DIR__ . '/../../lib/adminFooter.inc'; /** * Checks if a new device should be registered and adds it. * * @param htmlResponsiveRow $container row * @param WebauthnManager $webauthnManager webauthn manager */ function addNewDevice(htmlResponsiveRow $container, WebauthnManager $webauthnManager): void { if (empty($_POST['registrationData'])) { return; } $registrationData = base64_decode($_POST['registrationData']); $loader = $webauthnManager->createPublicKeyCredentialLoader(); $registrationObject = $loader->deserialize($_SESSION['webauthn_registration'], PublicKeyCredentialCreationOptions::class, 'json'); $success = $webauthnManager->storeNewRegistration($registrationObject, $registrationData); if ($success) { $container->add(new htmlStatusMessage('INFO', _('The device was registered.'))); } else { $container->add(new htmlStatusMessage('ERROR', _('The device failed to register.'))); } } /** * Shows the message if a device was removed. * * @param htmlResponsiveRow $container row */ function showRemoveMessage(htmlResponsiveRow $container): void { if (!empty($_POST['removed']) && ($_POST['removed'] === 'true')) { $container->add(new htmlStatusMessage('INFO', _('The device was deleted.'))); } }