Allowing the change password form to be extended
authorRyan Lane <rlane@wikimedia.org>
Wed, 13 Jun 2012 16:34:32 +0000 (18:34 +0200)
committerAntoine Musso <hashar@free.fr>
Thu, 14 Jun 2012 15:23:44 +0000 (17:23 +0200)
Change-Id: Id676b1ec4b43140790b18a87bc8466f10c957577

RELEASE-NOTES-1.20
docs/hooks.txt
includes/specials/SpecialChangePassword.php

index fefb686..5018f9d 100644 (file)
@@ -70,6 +70,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
 * (bug 35705) QUnit upgraded from 1.2.0 to 1.7.0
 * cleanupSpam.php now can delete spam pages if --delete was specified instead of blanking
   them.
+* Added new hook ChangePasswordForm to allow adding of additional fields in Special:ChangePassword
 
 === Bug fixes in 1.20 ===
 * (bug 30245) Use the correct way to construct a log page title.
index a57d1d2..c1fd5fa 100644 (file)
@@ -677,6 +677,10 @@ $output: OutputPage object in use
 'CategoryPageView': before viewing a categorypage in CategoryPage::view
 $catpage: CategoryPage instance
 
+'ChangePasswordForm': For extensions that need to add a field to the ChangePassword form
+via the Preferences form
+&$extraFields: An array of arrays that hold fields like would be passed to the pretty function.
+
 'ChangesListInsertArticleLink': Override or augment link to article in RC list.
 &$changesList: ChangesList instance.
 &$articlelink: HTML of link to article (already filled-in).
index f6482ef..2b88325 100644 (file)
@@ -136,6 +136,15 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        $oldpassMsg = 'oldpassword';
                        $submitMsg = 'resetpass-submit-loggedin';
                }
+               $extraFields = array();
+               wfRunHooks( 'ChangePasswordForm', array( &$extraFields ) );
+               $prettyFields = array(
+                                       array( 'wpName', 'username', 'text', $this->mUserName ),
+                                       array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ),
+                                       array( 'wpNewPassword', 'newpassword', 'password', null ),
+                                       array( 'wpRetype', 'retypenew', 'password', null ),
+                               );
+               $prettyFields = array_merge( $prettyFields, $extraFields );
                $this->getOutput()->addHTML(
                        Xml::fieldset( $this->msg( 'resetpass_header' )->text() ) .
                        Xml::openElement( 'form',
@@ -149,12 +158,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" .
                        $this->msg( 'resetpass_text' )->parseAsBlock() . "\n" .
                        Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" .
-                       $this->pretty( array(
-                               array( 'wpName', 'username', 'text', $this->mUserName ),
-                               array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ),
-                               array( 'wpNewPassword', 'newpassword', 'password', null ),
-                               array( 'wpRetype', 'retypenew', 'password', null ),
-                       ) ) . "\n" .
+                       $this->pretty( $prettyFields ) . "\n" .
                        $rememberMe .
                        "<tr>\n" .
                                "<td></td>\n" .