From 7e9ddc0e23a5497cc87495f2673728e2d574d5d6 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Thu, 29 Jun 2006 00:57:56 +0000 Subject: [PATCH] * (bug 6006) Allow hiding the password change fields using an authentication plugin --- RELEASE-NOTES | 1 + includes/AuthPlugin.php | 9 +++++++ includes/SpecialPreferences.php | 46 +++++++++++++++++---------------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f100a7fa92..df8a8b1f71 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index 070fad93a9..1d95541853 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -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. diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 9faba35baf..114901e95f 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -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(''); # Password - $this->mOldpass = htmlspecialchars( $this->mOldpass ); - $this->mNewpass = htmlspecialchars( $this->mNewpass ); - $this->mRetypePass = htmlspecialchars( $this->mRetypePass ); - - $wgOut->addHTML( '
' . wfMsg( 'changepassword' ) . ''); - $wgOut->addHTML( - $this->addRow( - '', - "mOldpass}\" size='20' />" - ) . - $this->addRow( - '', - "mNewpass}\" size='20' />" - ) . - $this->addRow( - '', - "mRetypePass}\" size='20' />" - ) . - "
\n" . - $this->getToggle( "rememberpassword" ) . "
\n\n" ); + if( $wgAuth->allowPasswordChange() ) { + $this->mOldpass = htmlspecialchars( $this->mOldpass ); + $this->mNewpass = htmlspecialchars( $this->mNewpass ); + $this->mRetypePass = htmlspecialchars( $this->mRetypePass ); + + $wgOut->addHTML( '
' . wfMsg( 'changepassword' ) . ''); + $wgOut->addHTML( + $this->addRow( + '', + "mOldpass}\" size='20' />" + ) . + $this->addRow( + '', + "mNewpass}\" size='20' />" + ) . + $this->addRow( + '', + "mRetypePass}\" size='20' />" + ) . + "
\n" . + $this->getToggle( "rememberpassword" ) . "
\n\n" ); + } # # Enotif -- 2.20.1