-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I have a user who has forgotten their password. For a number of reasons, email is not available on this system, so I need to jam a new password into the database for him.
I see the user_password and user_newpassword fields in the user table, but they are obviously hashes of some sort.
Can someone post the syntax of the appropriate SQL to insert a new password?
Thanks in advance.
AL
Al Potter kirjoittaa maanantaina, 29. maaliskuuta 2004, kello 16:52:
I see the user_password and user_newpassword fields in the user table, but they are obviously hashes of some sort.
Can someone post the syntax of the appropriate SQL to insert a new password?
I _guess_ that the hash used is standard UNIX passwd hash which can be invoked with command 'htpasswd' but I do not know this for certain, I just do not see any reason to use any other hashing scheme
see 'man htpasswd' or 'htpasswd' or 'htpasswd --help' for more information
I hope this helps.
-juxho
Juho Heikkurinen juxo@consumerium.org writes:
I _guess_ that the hash used is standard UNIX passwd hash which can be invoked with command 'htpasswd' but I do not know this for certain, I just do not see any reason to use any other hashing scheme
see 'man htpasswd' or 'htpasswd' or 'htpasswd --help' for more information
I looked at the code. The relevant function is encryptPassword() in User.php. The password is calculated like this: md5(USER_ID + "-" + md5(USER_PASS))
Unless you have set $wgPasswordSalt to false in which case it is md5(USER_PASS)
If you want to create a new password, you can create the following PHP file: ,----[ genpwd.php ] | <? | $user_id=123; | $pass="reset"; | $salt=true; | | if($salt) | $pass_md5=md5($pass); | else | $pass_md5=$pass; | | print md5("{$user_id}-{$pass_md5}"); | print "\n"; | ?> `----
Adjust the first three lines to your needs and execute it on the command line with: `php genpwd.php' (no quotes). Or put it into your Web path and execute it with your favorite browser¹.
Hope this helps, Patrice
______________ ¹ http://www.mozilla.org/products/firefox/
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
mailinglists@patrice.ch said:
If you want to create a new password, you can create the following PHP file: ,----[ genpwd.php ] | <? | $user_id=123; | $pass="reset"; | $salt=true; | | if($salt) | $pass_md5=md5($pass); | else | $pass_md5=$pass; | | print md5("{$user_id}-{$pass_md5}"); | print "\n"; | ?> `----
This did the trick, so thank you very much.
Is there any chance this functionality could make it into a production release, preferably as a Sysop Only special Page?
AL
mediawiki-l@lists.wikimedia.org