From 780190859cb266e914422c9cd1ff2bf2f45f7784 Mon Sep 17 00:00:00 2001 From: Eduard Melnyk Date: Mon, 17 Feb 2020 13:01:55 +0100 Subject: [PATCH] VIPPS-284: Change customer confirmation email template with empty password --- Observer/ConfigObserver.php | 108 ++++++++++++++++++ composer.json | 2 +- etc/adminhtml/events.xml | 20 ++++ etc/email_templates.xml | 7 ++ i18n/nb_NO.csv | 2 + .../email/account_new_no_password.html | 59 ++++++++++ view/frontend/layout/checkout_index_index.xml | 3 +- view/frontend/web/css/source/_email.less | 44 +++++++ 8 files changed, 242 insertions(+), 3 deletions(-) create mode 100644 Observer/ConfigObserver.php create mode 100644 etc/adminhtml/events.xml create mode 100644 view/frontend/email/account_new_no_password.html create mode 100644 view/frontend/web/css/source/_email.less diff --git a/Observer/ConfigObserver.php b/Observer/ConfigObserver.php new file mode 100644 index 0000000..ebc7060 --- /dev/null +++ b/Observer/ConfigObserver.php @@ -0,0 +1,108 @@ +config = $config; + $this->configWriter = $configWriter; + $this->systemConfig = $systemConfig; + } + + /** + * {@inheritdoc} + * + * @param Observer $observer + */ + public function execute(Observer $observer) + { + $storeId = $observer->getStore(); + $websiteId = $observer->getWebsite(); + + if ($storeId) { + $scope = 'stores'; + $scopeId = (int) $storeId; + } elseif ($websiteId) { + $scope = 'websites'; + $scopeId = (int) $websiteId; + $storeId = 0; + } else { + $scope = 'default'; + $scopeId = 0; + $storeId = 0; + } + + if ($this->config->isEnabled($storeId)) { + $this->configWriter->save( + EmailNotification::XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE, + self::VIPPS_TEMPLATE_ID, + $scope, + $scopeId + ); + } else { + $this->configWriter->delete( + EmailNotification::XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE, + $scope, + $scopeId + ); + } + + $this->systemConfig->clean(); + } +} diff --git a/composer.json b/composer.json index 99a81fd..7afaa9b 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "psr/log": "~1.0" }, "type": "magento2-module", - "version": "1.2.1", + "version": "1.2.2", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/etc/adminhtml/events.xml b/etc/adminhtml/events.xml new file mode 100644 index 0000000..c677592 --- /dev/null +++ b/etc/adminhtml/events.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/etc/email_templates.xml b/etc/email_templates.xml index 4426b88..e59a3fc 100644 --- a/etc/email_templates.xml +++ b/etc/email_templates.xml @@ -22,4 +22,11 @@ type="html" module="Vipps_Login" area="frontend" /> + +