* (bug 8437) Make Title::loadRestrictions() initialise $mRestrictions properly
[lhc/web/wiklou.git] / includes / SpecialUserlogin.php
index 29281e6..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
@@ -369,10 +376,19 @@ class LoginForm {
                                // people who have been logging in with a temporary
                                // password for some time.
                                //
+                               // As a side-effect, we can authenticate the user's
+                               // e-mail address if it's not already done, since
+                               // the temporary password was sent via e-mail.
+                               //
+                               if( !$u->isEmailConfirmed() ) {
+                                       $u->confirmEmail();
+                               }
+                               
                                // At this point we just return an appropriate code
                                // indicating that the UI should show a password
                                // reset form; bot interfaces etc will probably just
                                // fail cleanly here.
+                               //
                                return self::RESET_PASS;
                        } else {
                                return '' == $this->mPassword ? self::EMPTY_PASS : self::WRONG_PASS;