Move some readonly around
authorumherirrender <umherirrender_de.wp@web.de>
Mon, 30 Jul 2012 16:46:01 +0000 (18:46 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Mon, 30 Jul 2012 16:46:01 +0000 (18:46 +0200)
Checking first permission and than read only is better, than user
without permissions does not retry it when read only is over.

Moving disallowUserJS to top so javascript is always not possible, same
is already done on Special:ChangePassword

Change-Id: Ia27ee177b67f1151fd1178b24744b65da8e756fd

includes/specials/SpecialChangeEmail.php
includes/specials/SpecialChangePassword.php

index a1c6fd2..167d4e2 100644 (file)
@@ -42,11 +42,13 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
        function execute( $par ) {
                global $wgAuth;
 
-               $this->checkReadOnly();
-
                $this->setHeaders();
                $this->outputHeader();
 
+               $out = $this->getOutput();
+               $out->disallowUserJs();
+               $out->addModules( 'mediawiki.special.changeemail' );
+
                if ( !$wgAuth->allowPropChange( 'emailaddress' ) ) {
                        $this->error( 'cannotchangeemail' );
                        return;
@@ -65,9 +67,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                        return;
                }
 
-               $out = $this->getOutput();
-               $out->disallowUserJs();
-               $out->addModules( 'mediawiki.special.changeemail' );
+               $this->checkReadOnly();
 
                $this->mPassword = $request->getVal( 'wpPassword' );
                $this->mNewEmail = $request->getVal( 'wpNewEmail' );
index b30605b..41b3b25 100644 (file)
@@ -37,7 +37,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 +48,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 +59,8 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        return;
                }
 
+               $this->checkReadOnly();
+
                if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) {
                        try {
                                $this->mDomain = $wgAuth->getDomain();