From: Rob Church Date: Sun, 30 Apr 2006 16:02:46 +0000 (+0000) Subject: Re-fix 5377 following privacy issues. Now holds back on the hooks until the scope... X-Git-Tag: 1.31.0-rc.0~57308 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=ead187f88271182d36a322f597521b785f1da0c9;p=lhc%2Fweb%2Fwiklou.git Re-fix 5377 following privacy issues. Now holds back on the hooks until the scope of the matter is determined. I want this double-checked before it's taken live, though. --- diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index caedffbcad..65ff6e2d35 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -135,27 +135,40 @@ class LoginForm { */ function addNewAccount() { global $wgUser, $wgEmailAuthentication; - + + # Create the account and abort if there's a problem doing so $u = $this->addNewAccountInternal(); - - if ($u == NULL) { + if( $u == NULL ) return; - } - - $wgUser = $u; - $wgUser->setCookies(); - - $wgUser->saveSettings(); - if( $wgEmailAuthentication && $wgUser->isValidEmailAddr( $wgUser->getEmail() ) ) { - $wgUser->sendConfirmationMail(); - } - - wfRunHooks( 'AddNewAccount', array( $u ) ); - - if( $this->hasSessionCookie() ) { - return $this->successfulLogin( wfMsg( 'welcomecreation', $wgUser->getName() ), false ); + + # Save user settings and send out an email authentication message if needed + $u->saveSettings(); + if( $wgEmailAuthentication && User::isValidEmailAddr( $u->getEmail() ) ) + $u->sendConfirmationMail(); + + # 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 + if( $wgUser->isAnon() ) { + $wgUser = $u; + $wgUser->setCookies(); + wfRunHooks( 'AddNewAccount', array( $wgUser ) ); + if( $this->hasSessionCookie() ) { + return $this->successfulLogin( wfMsg( 'welcomecreation', $wgUser->getName() ), false ); + } else { + return $this->cookieRedirectCheck( 'new' ); + } } else { - return $this->cookieRedirectCheck( 'new' ); + # Confirm that the account was created + global $wgOut; + $skin = $wgUser->getSkin(); + $self = Title::makeTitle( NS_SPECIAL, 'Userlogin' ); + $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) ); + $wgOut->setArticleRelated( false ); + $wgOut->setRobotPolicy( 'noindex,nofollow' ); + $wgOut->addHtml( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) ); + $wgOut->returnToMain( $self->getPrefixedText() ); + wfRunHooks( 'AddNewAccount', array( $u ) ); + return true; } }