0

I'm working on a custom module that relies upon some properties from Admin user model. I used the method hashPassword() in my custom model replicated from core customer model, and in there, there is a call for constant Mage_Admin_Model_User::HASH_SALT_LENGTH. When I was working with version 1.9, all was good to go, but then I needed to port the module for 1.6, and there started my problem. Turns out that above constant is not defined in 1.6, tried with defined(Mage_Admin_User_Model::HASH_SALT_LENGTH), but no success.

Magento 1.6 had the value hard-coded to 2, and 1.9 has this value in constant as 32.

Looking for a better approach than to just hard-code the value so in versions in-between, I can use the same value being used by core code.

0

The Mage_Admin_Model_User::HASH_SALT_LENGTH constant was introduced in Magento CE 1.8.0.0 – that is Mage_Admin module version 1.6.1.1.

So that's where your version switch should be applied like this:

$hashSaltLenght   = $legacyValue;
$mageAdminVersion = Mage::getConfig()->getModuleConfig('Mage_Admin')->version;
if (version_compare($mageAdminVersion, '1.6.1.0', '>')) {
    $hashSaltLenght = Mage_Admin_Model_User::HASH_SALT_LENGTH;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.