* Add a notification about the confirmation mail sent during account
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 14 Dec 2006 00:31:16 +0000 (00:31 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 14 Dec 2006 00:31:16 +0000 (00:31 +0000)
  creation, so people don't immediately go off to request a second one.
* Add a warning on Special:Confirmemail if a code was already sent and has
  not yet expired.

RELEASE-NOTES
includes/SpecialConfirmemail.php
includes/SpecialUserlogin.php
includes/User.php
languages/messages/MessagesEn.php

index 4b2b6ce..e02ed75 100644 (file)
@@ -306,6 +306,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 8239) correctly get 50 new contributions when clicking '(50 next)'
 * (bug 2259) Fix old regression where e-mail addresses were no longer
   confirmed on login with mailed password.
+* Add a notification about the confirmation mail sent during account
+  creation, so people don't immediately go off to request a second one.
+* Add a warning on Special:Confirmemail if a code was already sent and has
+  not yet expired.
 
 
 == Languages updated ==
index d109eee..e64232a 100644 (file)
@@ -64,6 +64,9 @@ class EmailConfirmation extends SpecialPage {
                                $time = $wgLang->timeAndDate( $wgUser->mEmailAuthenticated, true );
                                $wgOut->addWikiText( wfMsg( 'emailauthenticated', $time ) );
                        }
+                       if( $wgUser->isEmailConfirmationPending() ) {
+                               $wgOut->addWikiText( wfMsg( 'confirmemail_pending' ) );
+                       }
                        $wgOut->addWikiText( wfMsg( 'confirmemail_text' ) );
                        $self = SpecialPage::getTitleFor( 'Confirmemail' );             
                        $form  = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
index 5a0a571..e60e3d5 100644 (file)
@@ -163,8 +163,15 @@ class LoginForm {
 
                # Save user settings and send out an email authentication message if needed
                $u->saveSettings();
-               if( $wgEmailAuthentication && User::isValidEmailAddr( $u->getEmail() ) )
-                       $u->sendConfirmationMail();
+               if( $wgEmailAuthentication && User::isValidEmailAddr( $u->getEmail() ) ) {
+                       global $wgOut;
+                       $error = $u->sendConfirmationMail();
+                       if( WikiError::isError( $error ) ) {
+                               $wgOut->addWikiText( wfMsg( 'confirmemail_sendfailed', $error->getMessage() ) );
+                       } else {
+                               $wgOut->addWikiText( wfMsg( 'confirmemail_oncreate' ) );
+                       }
+               }
 
                # If not logged in, assume the new account as the current one and set session cookies
                # then show a "welcome" message or a "need cookies" message as needed
index 87f75a4..53b14ef 100644 (file)
@@ -2320,6 +2320,18 @@ class User {
                        return $confirmed;
                }
        }
+       
+       /**
+        * Return true if there is an outstanding request for e-mail confirmation.
+        * @return bool
+        */
+       function isEmailConfirmationPending() {
+               global $wgEmailAuthentication;
+               return $wgEmailAuthentication &&
+                       !$this->isEmailConfirmed() &&
+                       $this->mEmailToken &&
+                       $this->mEmailTokenExpires > wfTimestamp();
+       }
 
        /**
         * @param array $groups list of groups
index 79e7357..3544681 100644 (file)
@@ -2527,8 +2527,16 @@ is collapsed. Others will be hidden by default.
 before using e-mail features. Activate the button below to send a confirmation
 mail to your address. The mail will include a link containing a code; load the
 link in your browser to confirm that your e-mail address is valid.",
+'confirmemail_pending' => '<div class="error">
+A confirmation code has already been e-mailed to you; if you recently
+created your account, you may wish to wait a few minutes for it to
+arrive before trying to request a new code.
+</div>',
 'confirmemail_send' => 'Mail a confirmation code',
 'confirmemail_sent' => 'Confirmation e-mail sent.',
+'confirmemail_oncreate' => 'A confirmation code was sent to your e-mail address.
+This code is not required to log in, but you will need to provide it before
+enabling any e-mail-based features in the wiki.',
 'confirmemail_sendfailed' => 'Could not send confirmation mail. Check address for invalid characters.
 
 Mailer returned: $1',