Merge "fix hardcoded quote in Special:DoubleRedirects/BrokenRedirects"
[lhc/web/wiklou.git] / includes / specials / SpecialChangePassword.php
index b30605b..6280eb4 100644 (file)
@@ -27,6 +27,9 @@
  * @ingroup SpecialPage
  */
 class SpecialChangePassword extends UnlistedSpecialPage {
+
+       protected $mUserName, $mOldpass, $mNewpass, $mRetype, $mDomain;
+
        public function __construct() {
                parent::__construct( 'ChangePassword' );
        }
@@ -37,7 +40,9 @@ class SpecialChangePassword extends UnlistedSpecialPage {
        function execute( $par ) {
                global $wgAuth;
 
-               $this->checkReadOnly();
+               $this->setHeaders();
+               $this->outputHeader();
+               $this->getOutput()->disallowUserJs();
 
                $request = $this->getRequest();
                $this->mUserName = trim( $request->getVal( 'wpName' ) );
@@ -46,10 +51,6 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $this->mRetype = $request->getVal( 'wpRetype' );
                $this->mDomain = $request->getVal( 'wpDomain' );
 
-               $this->setHeaders();
-               $this->outputHeader();
-               $this->getOutput()->disallowUserJs();
-
                $user = $this->getUser();
                if( !$request->wasPosted() && !$user->isLoggedIn() ) {
                        $this->error( $this->msg( 'resetpass-no-info' )->text() );
@@ -61,6 +62,8 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        return;
                }
 
+               $this->checkReadOnly();
+
                if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) {
                        try {
                                $this->mDomain = $wgAuth->getDomain();
@@ -105,8 +108,11 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $this->getOutput()->redirect( $titleObj->getFullURL() );
        }
 
+       /**
+        * @param $msg string
+        */
        function error( $msg ) {
-               $this->getOutput()->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) );
+               $this->getOutput()->addHTML( Xml::element( 'p', array( 'class' => 'error' ), $msg ) );
        }
 
        function showForm() {
@@ -170,6 +176,10 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                );
        }
 
+       /**
+        * @param $fields array
+        * @return string
+        */
        function pretty( $fields ) {
                $out = '';
                foreach ( $fields as $list ) {
@@ -192,7 +202,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        if ( $type != 'text' )
                                $out .= Xml::label( $this->msg( $label )->text(), $name );
                        else
-                               $out .=  $this->msg( $label )->escaped();
+                               $out .= $this->msg( $label )->escaped();
                        $out .= "</td>\n";
                        $out .= "\t<td class='mw-input'>";
                        $out .= $field;
@@ -221,7 +231,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        throw new PasswordError( $this->msg( 'login-throttled' )->text() );
                }
 
-               if( !$user->checkTemporaryPassword($this->mOldpass) && !$user->checkPassword($this->mOldpass) ) {
+               if( !$user->checkTemporaryPassword( $this->mOldpass ) && !$user->checkPassword( $this->mOldpass ) ) {
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'wrongpassword' ) );
                        throw new PasswordError( $this->msg( 'resetpass-wrong-oldpass' )->text() );
                }
@@ -234,7 +244,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                try {
                        $user->setPassword( $this->mNewpass );
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'success' ) );
-                       $this->mNewpass = $this->mOldpass = $this->mRetypePass = '';
+                       $this->mNewpass = $this->mOldpass = $this->mRetype = '';
                } catch( PasswordError $e ) {
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) );
                        throw new PasswordError( $e->getMessage() );