From c96c0d9553bd269b5a7e107a51c2a14e96a018a6 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 29 Jan 2011 09:32:02 +0000 Subject: [PATCH] * (bug 22606) Follow-up r63059: don't send the "someone registred an account" message when setting email address (i.e. old one empty) in user preferences --- includes/Preferences.php | 3 ++- includes/User.php | 13 ++++++++++--- languages/messages/MessagesEn.php | 14 ++++++++++++++ maintenance/language/messages.inc | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/includes/Preferences.php b/includes/Preferences.php index 77f9d3d017..57dab312b5 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1288,7 +1288,8 @@ class Preferences { if ( $wgEmailAuthentication ) { # Mail a temporary password to the dirty address. # User can come back through the confirmation URL to re-enable email. - $result = $wgUser->sendConfirmationMail( $oldaddr != '' ); + $type = $oldaddr != '' ? 'changed' : 'set'; + $result = $wgUser->sendConfirmationMail( $type ); if ( !$result->isGood() ) { return htmlspecialchars( $result->getWikiText( 'mailerror' ) ); } elseif ( $entryPoint == 'ui' ) { diff --git a/includes/User.php b/includes/User.php index 2ef85d25e1..e336ea0c5f 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2917,10 +2917,10 @@ class User { * Generate a new e-mail confirmation token and send a confirmation/invalidation * mail to the user's given address. * - * @param $changed Boolean: whether the adress changed + * @param $type String: message to send, either "created", "changed" or "set" * @return Status object */ - function sendConfirmationMail( $changed = false ) { + function sendConfirmationMail( $type = 'created' ) { global $wgLang; $expiration = null; // gets passed-by-ref and defined in next line. $token = $this->confirmationToken( $expiration ); @@ -2928,7 +2928,14 @@ class User { $invalidateURL = $this->invalidationTokenUrl( $token ); $this->saveSettings(); - $message = $changed ? 'confirmemail_body_changed' : 'confirmemail_body'; + if ( $type == 'created' || $type === false ) { + $message = 'confirmemail_body'; + } elseif ( $type === true ) { + $message = 'confirmemail_body_changed'; + } else { + $message = 'confirmemail_body_' . $type; + } + return $this->sendMail( wfMsg( 'confirmemail_subject' ), wfMsg( $message, wfGetIP(), diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index b9a5bde35d..4aadb9d536 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -4057,6 +4057,20 @@ to cancel the e-mail address confirmation: $5 +This confirmation code will expire at $4.', +'confirmemail_body_set' => 'Someone, probably you, from IP address $1, +has set the e-mail address of the account "$2" to this address on {{SITENAME}}. + +To confirm that this account really does belong to you and reactivate +e-mail features on {{SITENAME}}, open this link in your browser: + +$3 + +If the account does *not* belong to you, follow this link +to cancel the e-mail address confirmation: + +$5 + This confirmation code will expire at $4.', 'confirmemail_invalidated' => 'E-mail address confirmation canceled', 'invalidateemail' => 'Cancel e-mail confirmation', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 7a8b7ff7c2..66bcdad06b 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -2990,6 +2990,7 @@ $wgMessageStructure = array( 'confirmemail_subject', 'confirmemail_body', 'confirmemail_body_changed', + 'confirmemail_body_set', 'confirmemail_invalidated', 'invalidateemail', ), -- 2.20.1