Merge "mediawiki.jqueryMsg: Refactor "Match PHP parser" test suite"
[lhc/web/wiklou.git] / includes / specials / SpecialConfirmemail.php
index 6757990..b6ab112 100644 (file)
@@ -38,6 +38,9 @@ class EmailConfirmation extends UnlistedSpecialPage {
         * Main execution point
         *
         * @param null|string $code Confirmation code passed to the page
+        * @throws PermissionsError
+        * @throws ReadOnlyError
+        * @throws UserNotLoggedIn
         */
        function execute( $code ) {
                $this->setHeaders();
@@ -45,6 +48,8 @@ class EmailConfirmation extends UnlistedSpecialPage {
                $this->checkReadOnly();
                $this->checkPermissions();
 
+               $this->requireLogin( 'confirmemail_needlogin' );
+
                // This could also let someone check the current email address, so
                // require both permissions.
                if ( !$this->getUser()->isAllowed( 'viewmyprivateinfo' ) ) {
@@ -52,22 +57,10 @@ class EmailConfirmation extends UnlistedSpecialPage {
                }
 
                if ( $code === null || $code === '' ) {
-                       if ( $this->getUser()->isLoggedIn() ) {
-                               if ( Sanitizer::validateEmail( $this->getUser()->getEmail() ) ) {
-                                       $this->showRequestForm();
-                               } else {
-                                       $this->getOutput()->addWikiMsg( 'confirmemail_noemail' );
-                               }
+                       if ( Sanitizer::validateEmail( $this->getUser()->getEmail() ) ) {
+                               $this->showRequestForm();
                        } else {
-                               $llink = Linker::linkKnown(
-                                       SpecialPage::getTitleFor( 'Userlogin' ),
-                                       $this->msg( 'loginreqlink' )->escaped(),
-                                       array(),
-                                       array( 'returnto' => $this->getTitle()->getPrefixedText() )
-                               );
-                               $this->getOutput()->addHTML(
-                                       $this->msg( 'confirmemail_needlogin' )->rawParams( $llink )->parse()
-                               );
+                               $this->getOutput()->addWikiMsg( 'confirmemail_noemail' );
                        }
                } else {
                        $this->attemptConfirm( $code );
@@ -111,7 +104,7 @@ class EmailConfirmation extends UnlistedSpecialPage {
                        $out->addWikiMsg( 'confirmemail_text' );
                        $form = Html::openElement(
                                'form',
-                               array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL() )
+                               array( 'method' => 'post', 'action' => $this->getPageTitle()->getLocalURL() )
                        ) . "\n";
                        $form .= Html::hidden( 'token', $user->getEditToken() ) . "\n";
                        $form .= Xml::submitButton( $this->msg( 'confirmemail_send' )->text() ) . "\n";