diff --git a/administrator/modules/mod_login/tmpl/default.php b/administrator/modules/mod_login/tmpl/default.php index 1dda7a9f4cbc5..1567145b7f959 100644 --- a/administrator/modules/mod_login/tmpl/default.php +++ b/administrator/modules/mod_login/tmpl/default.php @@ -113,11 +113,7 @@ class="btn btn-secondary btn-block mt-4 " - 'icon', - ], true) ?> - - + diff --git a/build/media_source/plg_system_webauthn/images/webauthn.svg b/build/media_source/plg_system_webauthn/images/webauthn.svg index e6150f1695742..8c2a302845b23 100644 --- a/build/media_source/plg_system_webauthn/images/webauthn.svg +++ b/build/media_source/plg_system_webauthn/images/webauthn.svg @@ -1 +1 @@ - + diff --git a/libraries/src/HTML/Helpers/Icons.php b/libraries/src/HTML/Helpers/Icons.php index 09b25b8f23e2c..ab94e2ebac80d 100644 --- a/libraries/src/HTML/Helpers/Icons.php +++ b/libraries/src/HTML/Helpers/Icons.php @@ -90,42 +90,4 @@ public static function button($button) return $layout->render($button); } - - /** - * Writes an inline '' element - * - * @param string $file The relative or absolute PATH to use for the src attribute. - * @param boolean $relative Flag if the path to the file is relative to the /media folder (and searches in template). - * - * @return string|null - * - * @since 4.0 - */ - public static function svg(string $file, bool $relative = true): ?string - { - // Check extension for .svg - $extension = strtolower(substr($file, -4)); - - if ($extension !== '.svg') - { - return null; - } - - // Get path to icon - $file = HTMLHelper::_('image', $file, '', '', $relative, true); - - // Make sure path is local to Joomla - $file = Path::check(JPATH_ROOT . '/' . substr($file, \strlen(Uri::root(true)))); - - // If you can't find the icon or if it's unsafe then skip it - if (!$file) - { - return null; - } - - // Get contents to display inline - $file = file_get_contents($file); - - return $file; - } } diff --git a/libraries/src/Helper/AuthenticationHelper.php b/libraries/src/Helper/AuthenticationHelper.php index 7d991d56d19c9..6212e4709375e 100644 --- a/libraries/src/Helper/AuthenticationHelper.php +++ b/libraries/src/Helper/AuthenticationHelper.php @@ -150,7 +150,6 @@ public static function getLoginButtons(string $formId): array 'tooltip' => '', 'icon' => '', 'image' => '', - 'svg' => '', 'class' => '', 'id' => '', 'onclick' => '', diff --git a/modules/mod_login/tmpl/default.php b/modules/mod_login/tmpl/default.php index 56e578873bb98..282032d0d2c55 100644 --- a/modules/mod_login/tmpl/default.php +++ b/modules/mod_login/tmpl/default.php @@ -129,11 +129,7 @@ class="btn btn-secondary btn-block mt-4 " - 'icon', - ], true) ?> - - + diff --git a/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php b/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php index e5a2ce3a00405..8213beee2c63d 100644 --- a/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php +++ b/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php @@ -146,6 +146,15 @@ public function onUserLoginButtons(string $form): array // Set up the JavaScript callback $url = $uri->toString(); + // Get local path to image + $image = HTMLHelper::_('image', 'plg_system_webauthn/webauthn.svg', '', '', true, true); + + // If you can't find the image then skip it + $image = $image ? JPATH_ROOT . substr($image, strlen(Uri::root(true))) : ''; + + // Extract image if it exists + $image = file_exists($image) ? file_get_contents($image) : ''; + return [ [ 'label' => 'PLG_SYSTEM_WEBAUTHN_LOGIN_LABEL', @@ -153,7 +162,7 @@ public function onUserLoginButtons(string $form): array 'id' => $randomId, 'data-webauthn-form' => $form, 'data-webauthn-url' => $url, - 'svg' => HTMLHelper::_('icons.svg', 'plg_system_webauthn/webauthn.svg', true), + 'image' => $image, 'class' => 'plg_system_webauthn_login_button', ], ];