From: Ævar Arnfjörð Bjarmason Date: Tue, 15 Nov 2005 23:50:23 +0000 (+0000) Subject: * Password changing script for idiot users with amnesia X-Git-Tag: 1.6.0~1173 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/voir.php?a=commitdiff_plain;h=7b9d10e1683ca21ecbd30c6e15466c5dc3caca31;p=lhc%2Fweb%2Fwiklou.git * Password changing script for idiot users with amnesia --- diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php new file mode 100644 index 0000000000..1e015fdcb4 --- /dev/null +++ b/maintenance/changePassword.php @@ -0,0 +1,51 @@ + + * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later + */ + +class ChangePassword { + var $dbw; + var $user, $password; + + function ChangePassword( $user, $password ) { + $this->user = User::newFromName( $user ); + $this->password = $password; + + $this->dbw =& wfGetDB( DB_MASTER ); + } + + function main() { + $fname = 'ChangePassword::main'; + + $this->dbw->update( 'user', + array( + 'user_password' => wfEncryptPassword( $this->user->getID(), $this->password ) + ), + array( + 'user_id' => $this->user->getID() + ), + $fname + ); + } +} +if ( in_array( '--help', $argv ) ) + die( + "Usage: php changePassword.php [--user=user --password=password | --help]\n" . + "\toptions:\n" . + "\t\t--help\tshow this message\n" . + "\t\t--user\tthe username to operate on\n" . + "\t\t--password\tthe password to use\n" + ); + +$optionsWithArgs = array( 'user', 'password' ); +require_once 'commandLine.inc'; + +$cp = new ChangePassword( @$options['user'], @$options['password'] ); +$cp->main();