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' ) {
* 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 );
$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(),
$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',
'confirmemail_subject',
'confirmemail_body',
'confirmemail_body_changed',
+ 'confirmemail_body_set',
'confirmemail_invalidated',
'invalidateemail',
),