We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28840
    • 46 Posts
    Hi folks,

    I have an old DB with users in custom table, where paswds are hashed by md5. When i try:
    $user = $modx->newObject('modUser');
    $user->set('hash_class','hashing.modMD5');
    $user->set('password','hashedMD5string');
    

    the password gets double-hashed (so insted of just using the hash it hashes the hashedMD5string).

    I looked in modUser.class.php and found this comment:
        /**
         * The modUser password field is hashed automatically.
         *
         * {@inheritdoc}
         */

    Which makes it a problem...how do i import the hashed passwords with modUser class?
    I can update manually each row after the $user->save() function but that is just doubling the queries...

    Any ideas?

    Sumoborac
      • 22303 MODX Staff
      • 10,725 Posts
      $user->set('hash_class', 'hashing.modMD5');
      $user->password = $hashedMD5string;
      $user->setDirty('password');
        • 28840
        • 46 Posts
        Yeah i knew it was something like this... me being a good boy, always setting everything by setters and getters... arght... Thx opengeek i'll try it:)


        Sumoborac