有人知道在哪里可以找到发送给用户的电子邮件中忘记密码重置链接的功能吗?
由于一些奇怪的原因,我正在生成重置密码链接,其URL中的商店视图与用于重置密码的商店视图不同。
链接应为:
example.com/customer/account/resetpassword/?id=555&token=55555555555555555
但它正在生成:
example.com/otherStoreView/customer/account/resetpassword/?id=555&token=55555555555555555
答案 0 :(得分:3)
要解决此问题,请打开文件" app \ code \ local \ Mage \ Customer \ Model \ Customer.php"。
查找函数 sendPasswordResetConfirmationEmail()。它靠近685线。
此功能如下所示:
/**
* Send email with reset password confirmation link
*
* @return Mage_Customer_Model_Customer
*/
public function sendPasswordResetConfirmationEmail()
{
$storeId = $this->getStoreId();
if (!$storeId) {
$storeId = $this->_getWebsiteStoreId();
}
$this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
array('customer' => $this), $storeId);
return $this;
}
在这个函数中,Magento获取用户注册的商店ID,但是我们需要商店ID来进行密码重置请求。我们只需删除一些行并添加一个新行:
public function sendPasswordResetConfirmationEmail()
{
# this will get the current store ID
$storeId = Mage::app()->getStore()->getStoreId();
$this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
array('customer' => $this), $storeId);
return $this;
}
这对我有用,我希望它有所帮助。
答案 1 :(得分:2)
电子邮件模板是: 应用程序/区域/ langcode_COUNRTYCODE /模板/电子邮件/ account_password_reset_confirmation.html
生成网址的行是
{{store url="customer/account/resetpassword/" _query_id=$customer.id _query_token=$customer.rp_token}}