* Main execution point
*
* @param null|string $code Confirmation code passed to the page
+ * @throws PermissionsError
+ * @throws ReadOnlyError
+ * @throws UserNotLoggedIn
*/
function execute( $code ) {
$this->setHeaders();
$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' ) ) {
}
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 );
$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";