From d31bba925e562707cb01f9f46ebcfd4e777c3f24 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 4 Jun 2020 17:55:11 -0600 Subject: [PATCH 1/3] =?UTF-8?q?Don=E2=80=99t=20autocomplete=20password=20f?= =?UTF-8?q?ield?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Miller --- blueprints.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blueprints.yaml b/blueprints.yaml index 8f4858e..89e576e 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -20,6 +20,7 @@ dependencies: form: validation: loose + fields: enabled: type: hidden @@ -170,13 +171,13 @@ form: mailer.smtp.user: type: text size: medium - autocomplete: nope + autocomplete: 'off' label: PLUGIN_EMAIL.SMTP_LOGIN_NAME mailer.smtp.password: type: password size: medium - autocomplete: nope + autocomplete: 'new-password' label: PLUGIN_EMAIL.SMTP_PASSWORD sendmail_config: From ad3d4752c15a4c40cc564065ae5c6e23dd23ed1e Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 4 Jun 2020 17:55:30 -0600 Subject: [PATCH 2/3] =?UTF-8?q?Don=E2=80=99t=20save=20empty=20password=20#?= =?UTF-8?q?134?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Miller --- CHANGELOG.md | 7 +++++++ email.php | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6450906..9289a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v3.0.9 +## mm/dd/2020 + +1. [](#improved) + * Disable password autocomplete in password field + * Don't save empty string in password field [#134](https://github.com/getgrav/grav-plugin-email/issues/134) + # v3.0.8 ## 04/27/2020 diff --git a/email.php b/email.php index ec82f3b..8879aed 100644 --- a/email.php +++ b/email.php @@ -1,6 +1,7 @@ ['onFormProcessed', 0], 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0], 'onSchedulerInitialized' => ['onSchedulerInitialized', 0], + 'onAdminSave' => ['onAdminSave', 0], ]; } @@ -48,6 +50,28 @@ public function onTwigTemplatePaths() $twig->twig_paths[] = __DIR__ . '/templates'; } + /** + * Force compile during save if admin plugin save + * + * @param Event $event + */ + public function onAdminSave(Event $event) + { + /** @var Data $obj */ + $obj = $event['object']; + + + + if ($obj instanceof Data && $obj->blueprints()->getFilename() === 'email/blueprints') { + $current_pw = $this->grav['config']->get('plugins.email.mailer.smtp.password'); + $new_pw = $obj->get('mailer.smtp.password'); + if (!empty($current_pw) && empty($new_pw)) { + $obj->set('mailer.smtp.password', $current_pw); + } + + } + } + /** * Send email when processing the form data. * From 9c7f5a5e8d6353b1da9923d44ff18dc24d38a12b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 8 Jun 2020 15:32:48 -0600 Subject: [PATCH 3/3] prepare for release Signed-off-by: Andy Miller --- CHANGELOG.md | 2 +- blueprints.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9289a50..faf0d7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v3.0.9 -## mm/dd/2020 +## 06/08/2020 1. [](#improved) * Disable password autocomplete in password field diff --git a/blueprints.yaml b/blueprints.yaml index 89e576e..f5b7979 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,7 +1,7 @@ name: Email slug: email type: plugin -version: 3.0.8 +version: 3.0.9 testing: false description: Enables the emailing system for Grav icon: envelope