Extension:Password Reset

Password Reset extension allows Wiki users with the 'userrights' permission (Bureaucrat by default) to reset MediaWiki user's passwords (Local users only).

Installation

 * 1) Copy the Source Code (below) create the three required files: PasswordReset_body.php, PasswordReset.i18n.php, and PasswordReset.php
 * 2) Create a new folder (directory) in the following location: wiki-install-folder/extensions/PasswordReset
 * 3) Copy the three files in to the new PasswordReset folder
 * 4) Add the following code to your LocalSettings.php (at the bottom, before the closing "?>")

PasswordReset_body.php
 ");

if ($validUser && $passMatch) { $wgOut->addWikiText ( " \n" ); $wgOut->addWikiText ( $this->resetPassword( $userID, $newpass ) ); } else { //Invalid user or passwords don't match - do nothing }       }

function resetPassword( $userID, $newpass ) { $dbw =& wfGetDB( DB_MASTER );

$userTable = $dbw->tableName('user'); $sql = "update $userTable set user_password=MD5(CONCAT('$userID-',MD5('$newpass'))) WHERE user_id=$userID"; $res = $dbw->query($sql); if ( $res > 0 ) { return "Password has been reset for user_id: $userID"; } else { return "Unable to reset password for user_id: $userID"; }       }

function loadMessages { static $messagesLoaded = false; global $wgMessageCache; if ( $messagesLoaded ) return true; $messagesLoaded = true;

require( dirname( __FILE__ ) . '/PasswordReset.i18n.php' ); foreach ( $allMessages as $lang => $langMessages ) { $wgMessageCache->addMessages( $langMessages, $lang ); }

return true; } }

Usage

 * 1) Follow Installation Instructions
 * 2) You will have a new Special Page titled "Password Reset"