Skip to content

Commit

Permalink
1062: Added notification to encrypt settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
cableman committed Apr 5, 2024
1 parent e5ff659 commit 64d9736
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/os2forms_encrypt/src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;

/**
* Class Os2FormsEncryptAdminForm.
Expand Down Expand Up @@ -37,6 +38,18 @@ public function getFormId(): string {
public function buildForm(array $form, FormStateInterface $form_state): array {
$config = $this->config('os2forms_encrypt.settings');

$link = Link::createFromRoute($this->t('administration'), 'entity.key.collection');
$form['notice'] = [
'#type' => 'inline_template',
'#template' => '<h3>{{ title }}</h3><p>{{ message|t }}</p><p>{{ adminMessage|t }}</p>',
'#context' => [
'classes' => 'notification',
'title' => 'Please note',
'message' => 'The encryption key that comes with this module should <strong>not</strong> be used and should be changed before encrypting anything.',
'adminMessage' => 'You can modify the key (named "webform") in the keys ' . $link->toString() . ' panel. Additionally, the execution of this command can generate a new 256-bit key for you: <pre>dd if=/dev/urandom bs=32 count=1 | base64 -i -</pre>',
],
];

$form['enabled'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enabled encryption'),
Expand Down

0 comments on commit 64d9736

Please sign in to comment.