问题
I have a problem with displaying the password in email (account_new.html)
<strong>Email</strong>: {{var customer.email}}<br/>
<strong>Password</strong>: {{htmlescape var=$customer.password}}<p>
After registration password is not displayed in the template. How can I fix this? I use magento 1.9.1.0
回答1:
Magento 1.9 version has problem to send password in emails.
and not set var values under {{htmlescape var=$customer.password}}
There is one solution to send password in email
Open the core file or extend as you like AccountController.php,
find the function createPostAction()
on line 285 or find
$customer->cleanPasswordsValidationData();
just comment it like this
// $customer->cleanPasswordsValidationData();
also do it in other places as on line 809, 954
now it sends the password to customer new account email.
Other method
open or extend the custom model file
magento\app\code\core\Mage\Customer\Model\Customer.php
find the function
public function cleanPasswordsValidationData()
{
$this->setData('password', null);
$this->setData('password_confirmation', null);
return $this;
}
comment out // $this->setData('password', null);
public function cleanPasswordsValidationData()
{
// $this->setData('password', null);
$this->setData('password_confirmation', null);
return $this;
}
回答2:
It is not possible because password will be stored in encrypted format. It is in irreversible format.
Sending the password in mail is not the best practice. You have to follow up the best practices, Even though if your client is insisting you to do this thing. You have to convince him to not go with this kind of thing.
As customer had given the password while the registration process. Obviously he knows his password. If he forgotten then he can use the forgot password to get his new password.
Anyway I will not suggest you here to send the password through email, Sorry.
来源:https://stackoverflow.com/questions/28840703/customers-password-not-displayed-in-email-templates-magento-1-9-1-0