From 105ebc6883fb85db04647088ff7f39088e5229cc Mon Sep 17 00:00:00 2001 From: umherirrender Date: Mon, 30 Jul 2012 18:46:01 +0200 Subject: [PATCH] Move some readonly around 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 | 10 +++++----- includes/specials/SpecialChangePassword.php | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index a1c6fd2a57..167d4e2c80 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -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' ); diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index b30605b7e1..41b3b2558f 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -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(); -- 2.20.1