From: Brion Vibber Date: Thu, 14 Dec 2006 00:31:16 +0000 (+0000) Subject: * Add a notification about the confirmation mail sent during account X-Git-Tag: 1.31.0-rc.0~54909 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=9bac5f13a44bdd0d0513f8215c075ffcedddcc4b;p=lhc%2Fweb%2Fwiklou.git * 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. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4b2b6ced20..e02ed75848 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/SpecialConfirmemail.php b/includes/SpecialConfirmemail.php index d109eee785..e64232aa9a 100644 --- a/includes/SpecialConfirmemail.php +++ b/includes/SpecialConfirmemail.php @@ -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() ) ); diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 5a0a571067..e60e3d54ed 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -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 diff --git a/includes/User.php b/includes/User.php index 87f75a45e4..53b14ef4cc 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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 diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 79e7357f29..3544681305 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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' => '
+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. +
', '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',