Skip to content

Commit

Permalink
CORE-1743: Use existing logic for restore link generation
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilinTv committed Aug 14, 2017
1 parent 394a6dd commit 325d675
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/Spryker/Zed/Customer/Business/Customer/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div style="text-align: center;">
{{ 'mail.customer.restore_password.text' | trans }}<br>
<a href="{{ mail.customer.restorePasswordLink|replace({'token-placeholder': mail.customer.restorePasswordKey}) }}">{{ 'customer.password.update'| trans }}</a>
<a href="{{ mail.customer.restorePasswordLink }}">{{ 'customer.password.update'| trans }}</a>
</div>

0 comments on commit 325d675

Please sign in to comment.