* (bug 6006) Allow hiding the password change fields using an authentication plugin
authorRob Church <robchurch@users.mediawiki.org>
Thu, 29 Jun 2006 00:57:56 +0000 (00:57 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Thu, 29 Jun 2006 00:57:56 +0000 (00:57 +0000)
RELEASE-NOTES
includes/AuthPlugin.php
includes/SpecialPreferences.php

index f100a7f..df8a8b1 100644 (file)
@@ -599,6 +599,7 @@ Some default configuration options have changed:
 * (bug 6461) Link to page histories in Special:Newpages
 * (bug 6484) Don't do message transformations when preloading messages for editing
 * (bug 6201) Treat spaces as underscores in parameters to {{ns:}}
+* (bug 6006) Allow hiding the password change fields using an authentication plugin
 
 == Compatibility ==
 
index 070fad9..1d95541 100644 (file)
@@ -135,6 +135,15 @@ class AuthPlugin {
                return false;
        }
 
+       /**
+        * Can users change their passwords?
+        *
+        * @return bool
+        */
+       function allowPasswordChange() {
+               return true;
+       }
+
        /**
         * Set the given password in the authentication database.
         * Return true if successful.
index 9faba35..114901e 100644 (file)
@@ -205,7 +205,7 @@ class PreferencesForm {
                global $wgAuth;
 
 
-               if ( '' != $this->mNewpass ) {
+               if ( '' != $this->mNewpass && $wgAuth->allowPasswordChange() ) {
                        if ( $this->mNewpass != $this->mRetypePass ) {
                                $this->mainPrefsForm( 'error', wfMsg( 'badretype' ) );
                                return;
@@ -453,7 +453,7 @@ class PreferencesForm {
                global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
                global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
                global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
-               global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins;
+               global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
 
                $wgOut->setPageTitle( wfMsg( 'preferences' ) );
                $wgOut->setArticleRelated( false );
@@ -652,26 +652,28 @@ class PreferencesForm {
                $wgOut->addHTML('</table>');
 
                # Password
-               $this->mOldpass = htmlspecialchars( $this->mOldpass );
-               $this->mNewpass = htmlspecialchars( $this->mNewpass );
-               $this->mRetypePass = htmlspecialchars( $this->mRetypePass );
-
-               $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'changepassword' ) . '</legend><table>');
-               $wgOut->addHTML(
-                       $this->addRow(
-                               '<label for="wpOldpass">' . wfMsg( 'oldpassword' ) . '</label>',
-                               "<input type='password' name='wpOldpass' id='wpOldpass' value=\"{$this->mOldpass}\" size='20' />"
-                       ) .
-                       $this->addRow(
-                               '<label for="wpNewpass">' . wfMsg( 'newpassword' ) . '</label>',
-                               "<input type='password' name='wpNewpass' id='wpNewpass' value=\"{$this->mNewpass}\" size='20' />"
-                       ) .
-                       $this->addRow(
-                               '<label for="wpRetypePass">' . wfMsg( 'retypenew' ) . '</label>',
-                               "<input type='password' name='wpRetypePass' id='wpRetypePass' value=\"{$this->mRetypePass}\" size='20' />"
-                       ) .
-                       "</table>\n" .
-                       $this->getToggle( "rememberpassword" ) . "</fieldset>\n\n" );
+               if( $wgAuth->allowPasswordChange() ) {
+                       $this->mOldpass = htmlspecialchars( $this->mOldpass );
+                       $this->mNewpass = htmlspecialchars( $this->mNewpass );
+                       $this->mRetypePass = htmlspecialchars( $this->mRetypePass );
+       
+                       $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'changepassword' ) . '</legend><table>');
+                       $wgOut->addHTML(
+                               $this->addRow(
+                                       '<label for="wpOldpass">' . wfMsg( 'oldpassword' ) . '</label>',
+                                       "<input type='password' name='wpOldpass' id='wpOldpass' value=\"{$this->mOldpass}\" size='20' />"
+                               ) .
+                               $this->addRow(
+                                       '<label for="wpNewpass">' . wfMsg( 'newpassword' ) . '</label>',
+                                       "<input type='password' name='wpNewpass' id='wpNewpass' value=\"{$this->mNewpass}\" size='20' />"
+                               ) .
+                               $this->addRow(
+                                       '<label for="wpRetypePass">' . wfMsg( 'retypenew' ) . '</label>',
+                                       "<input type='password' name='wpRetypePass' id='wpRetypePass' value=\"{$this->mRetypePass}\" size='20' />"
+                               ) .
+                               "</table>\n" .
+                               $this->getToggle( "rememberpassword" ) . "</fieldset>\n\n" );
+               }
 
                # <FIXME>
                # Enotif