r50086 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50085‎ | r50086 | r50087 >
Date:01:27, 1 May 2009
Author:demon
Status:ok (Comments)
Tags:
Comment:
(bug 9219) Auth plugins can control editing RealName/Email/Nick preferences. Based on patch by MrPete.
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/AuthPlugin.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -81,6 +81,7 @@
8282 * Michael Walsh
8383 * Mike Horvath
8484 * Mormegil
 85+* MrPete
8586 * Nakon
8687 * Nathan Larson
8788 * nephele
Index: trunk/phase3/includes/AuthPlugin.php
@@ -130,8 +130,35 @@
131131 public function allowPasswordChange() {
132132 return true;
133133 }
 134+
 135+ /**
 136+ * Can users change their Real Name?
 137+ *
 138+ * @return bool
 139+ */
 140+ public function allowRealNameChange() {
 141+ return false;
 142+ }
134143
135144 /**
 145+ * Can users change their email address?
 146+ *
 147+ * @return bool
 148+ */
 149+ public function allowEmailChange() {
 150+ return false;
 151+ }
 152+
 153+ /**
 154+ * Can users change their Nickname?
 155+ *
 156+ * @return bool
 157+ */
 158+ public function allowNickChange() {
 159+ return false;
 160+ }
 161+
 162+ /**
136163 * Set the given password in the authentication database.
137164 * As a special case, the password may be set to null to request
138165 * locking the password to an unusable value, with the expectation
Index: trunk/phase3/includes/Preferences.php
@@ -138,11 +138,11 @@
139139 }
140140
141141 // Actually changeable stuff
142 - global $wgAllowRealName;
 142+ global $wgAllowRealName, $wgAuth;
143143 if ($wgAllowRealName) {
144144 $defaultPreferences['realname'] =
145145 array(
146 - 'type' => 'text',
 146+ 'type' => $wgAuth->allowRealNameChange() ? 'text' : 'info',
147147 'default' => $user->getRealName(),
148148 'section' => 'personal/info',
149149 'label-message' => 'yourrealname',
@@ -164,7 +164,6 @@
165165 'help-message' => 'prefs-help-gender',
166166 );
167167
168 - global $wgAuth;
169168 if ($wgAuth->allowPasswordChange()) {
170169 global $wgUser; // For skin.
171170 $link = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'ResetPass' ),
@@ -253,7 +252,7 @@
254253 global $wgMaxSigChars;
255254 $defaultPreferences['nickname'] =
256255 array(
257 - 'type' => 'text',
 256+ 'type' => $wgAuth->allowNickChange() ? 'text' : 'info',
258257 'maxlength' => $wgMaxSigChars,
259258 'label-message' => 'yournick',
260259 'validation-callback' =>
@@ -274,7 +273,7 @@
275274
276275 $defaultPreferences['emailaddress'] =
277276 array(
278 - 'type' => 'text',
 277+ 'type' => $wgAuth->allowEmailChange() ? 'text' : 'info',
279278 'default' => $user->getEmail(),
280279 'section' => 'personal/email',
281280 'label-message' => 'youremail',
Index: trunk/phase3/RELEASE-NOTES
@@ -175,6 +175,7 @@
176176 * (bug 18242) Show the Subversion revision number per extensions in
177177 Special:Version
178178 * (bug 18420) Missing file revisions are handled gracefully now
 179+* (bug 9219) Auth plugins can control editing RealName/Email/Nick preferences
179180
180181 === Bug fixes in 1.15 ===
181182 * (bug 16968) Special:Upload no longer throws useless warnings.

Comments

#Comment by Werdna (talk | contribs)   01:34, 1 May 2009

Why is the default false?

#Comment by 😂 (talk | contribs)   01:36, 1 May 2009

Fixed in r50087

#Comment by Tim Starling (talk | contribs)   15:59, 19 May 2009

This may need some refactoring at some stage, $auth->allowPropChange('nickname') or some such.

Status & tagging log