Jump to content
TrinityCore

Problem with updating password in database


Gun5m0k3
 Share

Recommended Posts

Hi all,

I am currently working on a Drupal 8 module which enables user to create a WoW account on registering. However, I am facing a problem:

When I create a user in Drupal I see that the account table in the auth server gets filled with the correct data. On activating an account and updating its password it sets the new password correctly. But when editing your password again the SHA1 hash field in the database gets updated but the new password does not work. The old one still does work. I find this really strange since the SHA1 hash gets updated but the old password still works and the new one does not. Is there some sort of username/password cache in the authserver that needs to be reset on updating?

Below is my insert and update code:

INSERT

      $database->fields([
        'username' => strtoupper($username),
        'sha_pass_hash' => strtoupper($password),
        'sessionkey' => '0',
        'v' => '0',
        's' => '0',
        'email' => $emailAddress,
        'last_login' => '2000-01-01 00:00:00',
      ]);

UPDATE

      $database->fields([
        'username' => strtoupper($newUsername),
        'sha_pass_hash' => strtoupper($password),
        'email' => $newEmailAddress,
      ]);

P.S. I took the insert code from other PHP scripts and so I hope that I am doing the inserts and updates correctly. If not I would appreciate it if you could tell how to do it correctly.

Edited by MrPerfect
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...