r96606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96605‎ | r96606 | r96607 >
Date:19:54, 8 September 2011
Author:laner
Status:ok (Comments)
Tags:
Comment:
Adding support for domains in SpecialPasswordReset.php.
Modified paths:
  • /trunk/phase3/includes/AuthPlugin.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialPasswordReset.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AuthPlugin.php
@@ -262,6 +262,15 @@
263263 public function getUserInstance( User &$user ) {
264264 return new AuthPluginUser( $user );
265265 }
 266+
 267+ /**
 268+ * Get a list of domains (in HTMLForm options format) used.
 269+ *
 270+ * @return array
 271+ */
 272+ public function domainList() {
 273+ return array();
 274+ }
266275 }
267276
268277 class AuthPluginUser {
Index: trunk/phase3/includes/specials/SpecialPasswordReset.php
@@ -44,7 +44,7 @@
4545 }
4646
4747 protected function getFormFields() {
48 - global $wgPasswordResetRoutes;
 48+ global $wgPasswordResetRoutes, $wgAuth;
4949 $a = array();
5050 if ( isset( $wgPasswordResetRoutes['username'] ) && $wgPasswordResetRoutes['username'] ) {
5151 $a['Username'] = array(
@@ -60,6 +60,15 @@
6161 );
6262 }
6363
 64+ if ( isset( $wgPasswordResetRoutes['domain'] ) && $wgPasswordResetRoutes['domain'] ) {
 65+ $domains = $wgAuth->domainList();
 66+ $a['Domain'] = array(
 67+ 'type' => 'select',
 68+ 'options' => $domains,
 69+ 'label-message' => 'passwordreset-domain',
 70+ );
 71+ }
 72+
6473 return $a;
6574 }
6675
@@ -76,6 +85,9 @@
7786 if ( isset( $wgPasswordResetRoutes['email'] ) && $wgPasswordResetRoutes['email'] ) {
7887 $i++;
7988 }
 89+ if ( isset( $wgPasswordResetRoutes['domain'] ) && $wgPasswordResetRoutes['domain'] ) {
 90+ $i++;
 91+ }
8092 return wfMessage( 'passwordreset-pretext', $i )->parseAsBlock();
8193 }
8294
@@ -87,7 +99,16 @@
88100 * @return Bool|Array
89101 */
90102 public function onSubmit( array $data ) {
 103+ global $wgAuth;
91104
 105+ if ( isset( $data['Domain'] ) ) {
 106+ if ( $wgAuth->validDomain( $data['Domain'] ) ) {
 107+ $wgAuth->setDomain( $data['Domain'] );
 108+ } else {
 109+ $wgAuth->setDomain( 'invaliddomain' );
 110+ }
 111+ }
 112+
92113 if ( isset( $data['Username'] ) && $data['Username'] !== '' ) {
93114 $method = 'username';
94115 $users = array( User::newFromName( $data['Username'] ) );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1180,6 +1180,7 @@
11811181 'passwordreset-disabled' => 'Password resets have been disabled on this wiki.',
11821182 'passwordreset-pretext' => '{{PLURAL:$1||Enter one of the pieces of data below}}',
11831183 'passwordreset-username' => 'Username:',
 1184+'passwordreset-domain' => 'Domain:',
11841185 'passwordreset-email' => 'E-mail address:',
11851186 'passwordreset-emailtitle' => 'Account details on {{SITENAME}}',
11861187 'passwordreset-emailtext-ip' => 'Someone (probably you, from IP address $1) requested a reminder of your

Follow-up revisions

RevisionCommit summaryAuthorDate
r96610f'up r96606: register new message key to maintenance scriptraymond20:08, 8 September 2011
r96646Follow up for r96606. Adding a message for passwordreset-domain.laner05:04, 9 September 2011
r96849REL1_18: r96509, r96522, r96606, r96643, r96645, r96655, r96659, r96687, r967......reedy15:03, 12 September 2011

Comments

#Comment by Nikerabbit (talk | contribs)   04:49, 9 September 2011

Message documentation would be appreciated, since the word domain has multiple meanings.

Status & tagging log