Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将Laravel用户密码导入Magento密码_Php_Laravel_Magento_Hash - Fatal编程技术网

Php 将Laravel用户密码导入Magento密码

Php 将Laravel用户密码导入Magento密码,php,laravel,magento,hash,Php,Laravel,Magento,Hash,我正在将一个电子商务应用程序从Laravel移动到Magento。Laravel应用程序使用Laravel的默认密码哈希,我知道它使用Bcrypt Magento customer imports允许您导入密码哈希,但我认为Magento使用MD5。当然,当用户尝试登录时,Magento会将MD5哈希与Bcrypt哈希进行比较 有人知道怎么解决这个问题吗?是否可以将Magento设置为使用与Laravel相同的Bcrypt哈希?或者将Laravel散列“转换”为Magento可以理解的内容 非常

我正在将一个电子商务应用程序从Laravel移动到Magento。Laravel应用程序使用Laravel的默认密码哈希,我知道它使用Bcrypt

Magento customer imports允许您导入密码哈希,但我认为Magento使用MD5。当然,当用户尝试登录时,Magento会将MD5哈希与Bcrypt哈希进行比较

有人知道怎么解决这个问题吗?是否可以将Magento设置为使用与Laravel相同的Bcrypt哈希?或者将Laravel散列“转换”为Magento可以理解的内容

非常感谢

扩展客户模型“Mage\u Customer\u model\u Customer”,并写下如下内容:

class Namespace_Modulename_Model_Customer_Customer extends Mage_Customer_Model_Customer
{
    public function authenticate($login, $password)
    {
        $this->loadByEmail($login);
        if ($this->getConfirmation() && $this->isConfirmationRequired()) {
            throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'),
                self::EXCEPTION_EMAIL_NOT_CONFIRMED
            );
        }
        if (!$this->validatePassword($password)) {
            $hash=$this->getPasswordHash();
            if(!$this->YourCustomFunctionForPasswordCheck($password,$hash))
            {
                throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Invalid login or password.'),
                    self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD
                );
            }
        }

        Mage::dispatchEvent('customer_customer_authenticated', array(
           'model'    => $this,
           'password' => $password,
        ));

        return true;
    }
    public function YourCustomFunctionForPasswordCheck($password, $hash)
    {
        //Custom code for password check like Laravel.
    }
}
你当然不能“转换”散列;我还不知道有哪个Magento插件允许它使用password\u hash()/password\u verify()