gpt4 book ai didi

Magento Migrate 客户无需密码。

转载 作者:行者123 更新时间:2023-12-02 18:35:21 25 4
gpt4 key购买 nike

我正在将过时的 Saas 站点迁移到新的 magento 企业安装,并且不相信我能够传输客户密码。它们使用 Perl crypt() 函数进行加密。

我想知道最好的工作流程可能是什么,因为我确信其他人一定也遇到过类似的情况。

我不介意发送电子邮件要求所有客户创建新密码,或要求他们下次登录时创建新密码。

但是我应该在导入密码字段中输入什么?为了安全起见,我当然不能给每个人相同的临时密码。

我们有近 123,000 名客户(尽管其中许多人可能不再活跃),因此可能需要一段时间。

提前致谢。

最佳答案

我认为最好的方法是自动生成密码和帐户,所有这些都使用 Magento 的内置功能,如下所示:

$customer = Mage::getModel('customer/customer');

$password = '123456';
$email = 'testuser@test.com';

$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($email);

if(!$customer->getId()) { // if customer does not already exists, by email
// new data
$customer->setEmail($email);
$customer->setFirstname('Johnny');
$customer->setLastname('Doels');
$newPassword = $customer->generatePassword(); // generate a new password
$customer->changePassword($newPassword); // set it

} else {
// do something here for existing customers
}

try {
$customer->save();
$customer->setConfirmation(null);
$customer->save();
$customer->sendPasswordReminderEmail(); // save successful, send new password
}

catch (Exception $ex) {
//Zend_Debug::dump($ex->getMessage());
}

关于Magento Migrate 客户无需密码。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11264628/

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