1

Been using REST to create or update Customer record but the field password never able to be saved/updated regardless.

Below is the JSON output to Magento REST:

POST output:
{"website_id":1,"email":"00010@mycompany.com","group_id":1,"disable_auto_group_change":0,"prefix":"","firstname":"Newer10","middlename":"","lastname":"Corporation","suffix":"","taxvat":"","password":"Password123","password_confirmation":"Password123"}

The password at the end is MD5 hashed. I also tried plain text password and MD5 hash with salt separated by a colon.

To verify the record, I used Admin page > Manage Customers and verified record has been created.

However, when I tried to log in using the new email 00010@mycompany.com it's unable to log in due to an invalid username or password.

Also, I checked the database table, the password field was never created.

I put a Mage::Log before and after the $customer->save(); function and here are the latest result:

2015-07-17T08:53:39+00:00 DEBUG (7): array (
  'website_id' => 1,
  'group_id' => 1,
  'disable_auto_group_change' => 0,
  'prefix' => '',
  'firstname' => 'Newer10',
  'middlename' => '',
  'lastname' => 'Corporation',
  'suffix' => '',
  'email' => '00010@mycompany.com',
  'taxvat' => '',
)
2015-07-17T08:53:39+00:00 DEBUG (7): array (
  'website_id' => 1,
  'group_id' => 1,
  'disable_auto_group_change' => '0',
  'prefix' => '',
  'firstname' => 'Newer10',
  'middlename' => '',
  'lastname' => 'Corporation',
  'suffix' => '',
  'email' => '00010@mycompany.com',
  'taxvat' => '',
  'store_id' => '0',
  'entity_type_id' => '1',
  'parent_id' => 0,
  'created_at' => '2015-07-17 08:53:39',
  'updated_at' => '2015-07-17 08:53:39',
  'created_in' => 'Admin',
  'confirmation' => NULL,
  'entity_id' => '24',
)
0

You are allowed to edit everything which is returned by:

\Mage_Api2_Model_Resource::getEavAttributes

protected function _getResourceAttributes()
{
    return $this->getEavAttributes(Mage_Api2_Model_Auth_User_Admin::USER_TYPE != $this->getUserType(), true);
}

$excludeSystem is true

Therefore password is not one of them.

To change this, try with a update script:

$this->updateAttribute('password_hash', 'is_system', 0);
  • Thanks for the reply @Fabian Blechschmidt. I am new to Magento, can you show me which file I should edit this code? Thanks – d4v1dv00 Jul 17 '15 at 4:35
  • updated answer. – Fabian Blechschmidt Jul 17 '15 at 6:51
  • I already did that and there is still no password been stored in customer_entity_varchar neither the customer can login. – d4v1dv00 Jul 17 '15 at 8:59
0

Managed to resolve this issue by referring to the following post.

Please take the solution from @sebbrochet

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.