From 325d6750c0031bdff80f4462dbf71d93a6ca1c1e Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Mon, 14 Aug 2017 09:56:32 +0000 Subject: [PATCH] CORE-1743: Use existing logic for restore link generation --- .../Zed/Customer/Business/Customer/Customer.php | 14 ++++++++++---- .../Mail/customer_restore_password.html.twig | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Spryker/Zed/Customer/Business/Customer/Customer.php b/src/Spryker/Zed/Customer/Business/Customer/Customer.php index 2f80f8a3..b44a0db3 100644 --- a/src/Spryker/Zed/Customer/Business/Customer/Customer.php +++ b/src/Spryker/Zed/Customer/Business/Customer/Customer.php @@ -187,8 +187,14 @@ public function register(CustomerTransfer $customerTransfer) { $customerResponseTransfer = $this->add($customerTransfer); - if ($customerResponseTransfer->getIsSuccess()) { - $this->sendRegistrationToken($customerTransfer); + if (!$customerResponseTransfer->getIsSuccess()) { + return $customerResponseTransfer; + } + + $this->sendRegistrationToken($customerTransfer); + + if ($customerTransfer->getSendPasswordToken()) { + $this->sendPasswordRestoreMail($customerTransfer); } return $customerResponseTransfer; @@ -231,10 +237,10 @@ protected function generateKey() protected function sendPasswordRestoreToken(CustomerTransfer $customerTransfer) { $customerTransfer = $this->get($customerTransfer); - $confirmationLink = $this->customerConfig + $restorePasswordLink = $this->customerConfig ->getCustomerPasswordRestoreTokenUrl($customerTransfer->getRestorePasswordKey()); - $customerTransfer->setConfirmationLink($confirmationLink); + $customerTransfer->setRestorePasswordLink($restorePasswordLink); $mailTransfer = new MailTransfer(); $mailTransfer->setType(CustomerRestorePasswordMailTypePlugin::MAIL_TYPE); diff --git a/src/Spryker/Zed/Customer/Presentation/Mail/customer_restore_password.html.twig b/src/Spryker/Zed/Customer/Presentation/Mail/customer_restore_password.html.twig index 76dbfd57..29eb72bf 100644 --- a/src/Spryker/Zed/Customer/Presentation/Mail/customer_restore_password.html.twig +++ b/src/Spryker/Zed/Customer/Presentation/Mail/customer_restore_password.html.twig @@ -1,4 +1,4 @@
{{ 'mail.customer.restore_password.text' | trans }}
- {{ 'customer.password.update'| trans }} + {{ 'customer.password.update'| trans }}