芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/layouts.9/plugins/system/webauthn/manage.php
* @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\Uri\Uri; use Joomla\CMS\User\User; use Joomla\CMS\User\UserHelper; use Joomla\Plugin\System\Webauthn\Helper\CredentialsCreation; use Joomla\Plugin\System\Webauthn\Helper\Joomla; /** * Passwordless Login management interface * * * Generic data * * @var FileLayout $this The Joomla layout renderer * @var array $displayData The data in array format. DO NOT USE. * * Layout specific data * * @var User $user The Joomla user whose passwordless login we are managing * @var bool $allow_add Are we allowed to add passwordless login methods * @var array $credentials The already stored credentials for the user * @var string $error Any error messages */ // Extract the data. Do not remove until the unset() line. try { $app = Factory::getApplication(); $loggedInUser = $app->getIdentity(); $app->getDocument()->getWebAssetManager() ->registerAndUseStyle('plg_system_webauthn.backend', 'plg_system_webauthn/backend.css'); } catch (Exception $e) { $loggedInUser = new User; } $defaultDisplayData = [ 'user' => $loggedInUser, 'allow_add' => false, 'credentials' => [], 'error' => '', ]; extract(array_merge($defaultDisplayData, $displayData)); if ($displayData['allow_add'] === false) { $error = Text::_('PLG_SYSTEM_WEBAUTHN_CANNOT_ADD_FOR_A_USER'); $allow_add = false; } // Ensure the GMP or BCmath extension is loaded in PHP - as this is required by third party library if ($allow_add && function_exists('gmp_intval') === false && function_exists('bccomp') === false) { $error = Text::_('PLG_SYSTEM_WEBAUTHN_REQUIRES_GMP'); $allow_add = false; } /** * Why not push these configuration variables directly to JavaScript? * * We need to reload them every time we return from an attempt to authorize an authenticator. Whenever that * happens we push raw HTML to the page. However, any SCRIPT tags in that HTML do not get parsed, i.e. they * do not replace existing values. This causes any retries to fail. By using a data storage object we circumvent * that problem. */ $randomId = 'plg_system_webauthn_' . UserHelper::genRandomPassword(32); // phpcs:ignore $publicKey = $allow_add ? base64_encode(CredentialsCreation::createPublicKey($user)) : '{}'; $postbackURL = base64_encode(rtrim(Uri::base(), '/') . '/index.php?' . Joomla::getToken() . '=1'); ?>