wikislo
Registered
- Thread starter
- #1
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 (user_id). You do not need to change the salt, if you change it it must be the same as new-password.
The query doesn't look pretty and only uses SHA1, but it works fine. If you are confused about security, you should reset your password again in AdminCP once you have regained access. Resetting a password in AdminCP uses a more secure layer of authentication.
You need to replace new-password and 1 (user_id). You do not need to change the salt, if you change it it must be the same as new-password.
Code:
UPDATE xf_user_authenticate
SET data = BINARY
CONCAT(
CONCAT(
CONCAT('a:3:{s:4:"hash";s:40:"', SHA1(CONCAT(SHA1('new-password'), SHA1('salt')))),
CONCAT('";s:4:"salt";s:40:"', SHA1('salt'))
),
'";s:8:"hashFunc";s:4:"sha1";}'
),
scheme_class = 'XF:Core'
WHERE user_id = 1;
The query doesn't look pretty and only uses SHA1, but it works fine. If you are confused about security, you should reset your password again in AdminCP once you have regained access. Resetting a password in AdminCP uses a more secure layer of authentication.