【问题标题】:customer's password not displayed in email templates magento 1.9.1.0客户的密码未显示在电子邮件模板 magento 1.9.1.0 中
【发布时间】:2015-03-03 19:50:09
【问题描述】:

我在电子邮件中显示密码时遇到问题 (account_new.html)

<strong>Email</strong>: {{var customer.email}}<br/>
<strong>Password</strong>: {{htmlescape var=$customer.password}}<p>

注册后密码不显示在模板中。 我怎样才能解决这个问题?我使用 magento 1.9.1.0

【问题讨论】:

标签: magento passwords email-templates


【解决方案1】:

Magento 1.9 版本无法通过电子邮件发送密码。 而不是在{{htmlescape var=$customer.password}}下设置var值

在电子邮件中发送密码的一种解决方案

打开核心文件或根据需要扩展AccountController.php, 在第 285 行找到函数 createPostAction() 或找到

$customer->cleanPasswordsValidationData();

就这样评论吧

// $customer->cleanPasswordsValidationData();

也可以在其他地方进行,如第 809、954 行

现在它将密码发送到客户的新帐户电子邮件。

其他方法

打开或扩展自定义模型文件

magento\app\code\core\Mage\Customer\Model\Customer.php

找到函数

public function cleanPasswordsValidationData()
{
    $this->setData('password', null);
    $this->setData('password_confirmation', null);
    return $this;
} 

注释掉// $this-&gt;setData('password', null);

public function cleanPasswordsValidationData()
{
    // $this->setData('password', null);
    $this->setData('password_confirmation', null);
    return $this;
} 

【讨论】:

  • ti 可以工作,但是当注册客户时,请在主页上链接重定向。所以它会转到客户仪表板。如何重定向客户仪表板。 ?
【解决方案2】:

这是不可能的,因为密码将以加密格式存储。 它是不可逆的格式。

在邮件中发送密码并不是最佳做法。 你必须遵循最佳实践,即使你的客户坚持要你做这件事。你必须说服他不要去做这种事情。

由于客户在注册过程中提供了密码。显然他知道他的密码。如果他忘记了,那么他可以使用忘记的密码来获取他的新密码。

无论如何我不建议你在这里通过电子邮件发送密码,对不起。

【讨论】:

  • 您是正确的,发送明文密码是愚蠢的,但 Magento 确实保留了用于注册请求的其余部分的密码。因此,作为注册的一部分发送的电子邮件可以访问纯文本密码变量……默认行为就是这样做……除非 Magento 在 1.9.1 中更改了行为。
  • 在 1.9.3.0 中修复了,不是吗? stackoverflow.com/questions/28840703/…
猜你喜欢
  • 2023-04-02
  • 2012-12-09
  • 2014-05-17
  • 2015-06-10
  • 2012-05-16
  • 1970-01-01
  • 1970-01-01
  • 2019-08-11
  • 1970-01-01
相关资源
最近更新 更多