gpt4 book ai didi

Magento - 忘记密码链接生成使用了不正确的商店 View

转载 作者:行者123 更新时间:2023-12-02 21:58:03 24 4
gpt4 key购买 nike

有人知道我可以在哪里找到在发送给用户的电子邮件中生成忘记密码重置链接的功能吗?

出于某种奇怪的原因,我生成的重置密码链接的 URL 中的商店 View 与用于重置密码的商店 View 不同。

链接应该是:

example.com/customer/account/resetpassword/?id=555&token=55555555555555555

但它是这样生成的:

example.com/otherStoreView/customer/account/resetpassword/?id=555&token=55555555555555555

最佳答案

要解决此问题,请打开文件“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;
}

这对我有用,我希望它有帮助。

关于Magento - 忘记密码链接生成使用了不正确的商店 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17411600/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com