1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Password Reset Query

Discussion in 'Tips and Guides [Archive]' started by Jake Bunce, Jan 8, 2012.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can use this query to reset a user's password. It is especially useful if you forget your admin password.

    You need to replace new-password and 1 (the user_id). You don't have to change salt, but if you do then both instances need to be the same.

    UPDATE xf_user_authenticate
    SET data = BINARY
    			CONCAT('a:3:{s:4:"hash";s:40:"', SHA1(CONCAT(SHA1('new-password'), SHA1('salt')))),
    			CONCAT('";s:4:"salt";s:40:"', SHA1('salt'))
    scheme_class = 'XenForo_Authentication_Core'
    WHERE user_id = 1;
    It's ugly and only uses SHA1, but it works. If you are paranoid about security then you should reset your password again in the Admin CP once you regain access. Resetting the password in the Admin CP will use SHA256 hashing with a proper salt.
    Kira666, Andrej and giorgino like this.

Share This Page