Merge "rebuildLocalisationCache: Implement --lang option"
[lhc/web/wiklou.git] / includes / specials / SpecialChangePassword.php
index 95fbb0d..b53a46a 100644 (file)
@@ -54,11 +54,13 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $user = $this->getUser();
                if ( !$request->wasPosted() && !$user->isLoggedIn() ) {
                        $this->error( $this->msg( 'resetpass-no-info' )->text() );
+
                        return;
                }
 
                if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
                        $this->doReturnTo();
+
                        return;
                }
 
@@ -69,6 +71,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                                $this->mDomain = $wgAuth->getDomain();
                                if ( !$wgAuth->allowPasswordChange() ) {
                                        $this->error( $this->msg( 'resetpass_forbidden' )->text() );
+
                                        return;
                                }
 
@@ -90,6 +93,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                                        $login->setContext( $this->getContext() );
                                        $login->execute( null );
                                }
+
                                return;
                        } catch ( PasswordError $e ) {
                                $this->error( $e->getMessage() );
@@ -218,6 +222,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        $out .= "</td>\n";
                        $out .= "</tr>";
                }
+
                return $out;
        }
 
@@ -246,6 +251,12 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        throw new PasswordError( $this->msg( 'login-throttled' )->text() );
                }
 
+               $abortMsg = 'resetpass-abort-generic';
+               if ( !wfRunHooks( 'AbortChangePassword', array( $user, $this->mOldpass, $newpass, &$abortMsg ) ) ) {
+                       wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'abortreset' ) );
+                       throw new PasswordError( $this->msg( $abortMsg )->text() );
+               }
+
                if ( !$user->checkTemporaryPassword( $this->mOldpass ) && !$user->checkPassword( $this->mOldpass ) ) {
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'wrongpassword' ) );
                        throw new PasswordError( $this->msg( 'resetpass-wrong-oldpass' )->text() );