Fix regression with confirmation e-mails sent via Special:Confirmemail.
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 22 Apr 2008 23:47:27 +0000 (23:47 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 22 Apr 2008 23:47:27 +0000 (23:47 +0000)
Recent changes to User object made User::sendConfirmationEmail() *not* save the new confirmation token to the database, which seems rather odd. As a result, you got a mail with a bogus value.

Since the function has side-effects, it pretty clearly needs to be saving its changes. Went ahead and had it do that rather than forcing all callers to fix its internal failing.

includes/User.php

index 9ad7e18..7897c3c 100644 (file)
@@ -2461,8 +2461,8 @@ class User {
         * Generate a new e-mail confirmation token and send a confirmation/invalidation
         * mail to the user's given address.
         *
-        * Call saveSettings() after calling this function to commit the confirmation
-        * token to the database.
+        * Calls saveSettings() internally; as it has side effects, not committing changes
+        * would be pretty silly.
         *
         * @return mixed True on success, a WikiError object on failure.
         */
@@ -2472,6 +2472,8 @@ class User {
                $token = $this->confirmationToken( $expiration );
                $url = $this->confirmationTokenUrl( $token );
                $invalidateURL = $this->invalidationTokenUrl( $token );
+               $this->saveSettings();
+               
                return $this->sendMail( wfMsg( 'confirmemail_subject' ),
                        wfMsg( 'confirmemail_body',
                                wfGetIP(),