Use Joomla password field for AI key
This commit is contained in:
@@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
|
||||
|
||||
## Instalacja
|
||||
|
||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.42.7).
|
||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.42.8).
|
||||
|
||||
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
-- No database changes required for version 1.42.8.
|
||||
@@ -49,7 +49,7 @@ class ResultController extends BaseController
|
||||
} catch (\Throwable $error) {
|
||||
$errorMessage = $error->getMessage();
|
||||
$message = str_starts_with($errorMessage, 'AI_KEY_EMPTY|')
|
||||
? 'Diagnostyka konfiguracji AI (1.42.7): ' . substr($errorMessage, strlen('AI_KEY_EMPTY|'))
|
||||
? 'Diagnostyka konfiguracji AI (1.42.8): ' . substr($errorMessage, strlen('AI_KEY_EMPTY|'))
|
||||
: ($errorMessage === 'AI_NOT_CONFIGURED'
|
||||
? Text::_('COM_TESTQUESTIONS_AI_NOT_CONFIGURED')
|
||||
: Text::sprintf('COM_TESTQUESTIONS_AI_ERROR', $errorMessage));
|
||||
|
||||
@@ -4,24 +4,22 @@ namespace Komponent\Component\Testquestions\Administrator\Field;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\Form\Field\PasswordField;
|
||||
|
||||
class AiapikeyField extends FormField
|
||||
class AiapikeyField extends PasswordField
|
||||
{
|
||||
protected $type = 'Aiapikey';
|
||||
|
||||
protected function getInput(): string
|
||||
{
|
||||
$id = htmlspecialchars($this->id, ENT_QUOTES, 'UTF-8');
|
||||
$name = htmlspecialchars($this->name, ENT_QUOTES, 'UTF-8');
|
||||
$value = htmlspecialchars((string) $this->value, ENT_QUOTES, 'UTF-8');
|
||||
$length = mb_strlen((string) $this->value);
|
||||
|
||||
return '<div class="input-group">'
|
||||
. '<input type="password" id="' . $id . '" name="' . $name . '" value="' . $value . '" size="120" autocomplete="off" class="form-control">'
|
||||
. parent::getInput()
|
||||
. '<button type="button" class="btn btn-outline-secondary" data-ai-key-toggle="' . $id . '">Pokaż</button>'
|
||||
. '</div>'
|
||||
. '<small class="form-text text-muted">Zapisany klucz: ' . (int) $length . ' znaków.</small>'
|
||||
. '<small class="form-text text-muted">Klucz: ' . (int) $length . ' znaków.</small>'
|
||||
. '<script>
|
||||
document.addEventListener("click", function (event) {
|
||||
var button = event.target.closest("[data-ai-key-toggle]");
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<creationDate>2026-10-14</creationDate>
|
||||
<author>Komponent</author>
|
||||
<license>GNU General Public License version 2 or later</license>
|
||||
<version>1.42.7</version>
|
||||
<version>1.42.8</version>
|
||||
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
||||
<element>com_testquestions</element>
|
||||
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
||||
|
||||
Reference in New Issue
Block a user