(bug 5839) Prevent access to Special:Confirmemail for logged-out users
authorRob Church <robchurch@users.mediawiki.org>
Fri, 5 May 2006 15:17:43 +0000 (15:17 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 5 May 2006 15:17:43 +0000 (15:17 +0000)
RELEASE-NOTES
includes/SpecialConfirmemail.php
languages/Messages.php

index d6b0306..0ab80f5 100644 (file)
@@ -217,6 +217,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 5838) Namespace names for Nds-NL
 * (bug 5749) Added Tyvan language files
 * (bug 5791) Fix SQL syntax in Special:BrokenRedirects, was causing incorrect data to show
+* (bug 5839) Prevent access to Special:Confirmemail for logged-out users
 
 == Compatibility ==
 
index a97ddd9..7143d9d 100644 (file)
@@ -18,13 +18,29 @@ function wfSpecialConfirmemail( $code ) {
 class ConfirmationForm {
        /** */
        function show( $code ) {
-               if( empty( $code ) ) {
+               global $wgUser;
+               if( !$wgUser->isLoggedIn() ) {
+                       $this->showNeedLogin();
+               } elseif( empty( $code ) ) {
                        $this->showEmpty( $this->checkAndSend() );
                } else {
                        $this->showCode( $code );
                }
        }
 
+       function showNeedLogin() {
+               global $wgOut, $wgUser;
+               
+               $title = Title::makeTitle( NS_SPECIAL, 'Userlogin' );
+               $self = Title::makeTitle( NS_SPECIAL, 'Confirmemail' );
+               $skin = $wgUser->getSkin();
+               $llink = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $self->getPrefixedUrl() );
+               
+               $wgOut->setPageTitle( wfMsg( 'confirmemail' ) );
+               $wgOut->addHtml( wfMsgWikiHtml( 'confirmemail_needlogin', $llink ) );
+               return;
+       }
+
        /** */
        function showCode( $code ) {
                $user = User::newFromConfirmationCode( $code );
index a67041a..b010952 100644 (file)
@@ -1933,6 +1933,7 @@ link in your browser to confirm that your e-mail address is valid.",
 'confirmemail_sent' => 'Confirmation e-mail sent.',
 'confirmemail_sendfailed' => 'Could not send confirmation mail. Check address for invalid characters.',
 'confirmemail_invalid' => 'Invalid confirmation code. The code may have expired.',
+'confirmemail_needlogin' => 'You need to $1 to confirm your email address.',
 'confirmemail_success' => 'Your e-mail address has been confirmed. You may now log in and enjoy the wiki.',
 'confirmemail_loggedin' => 'Your e-mail address has now been confirmed.',
 'confirmemail_error' => 'Something went wrong saving your confirmation.',