/**
* constructor
*/
-function wfSpecialUserlogin() {
+function wfSpecialUserlogin( $par = '' ) {
global $wgRequest;
if( session_id() == '' ) {
wfSetupSession();
}
- $form = new LoginForm( $wgRequest );
+ $form = new LoginForm( $wgRequest, $par );
$form->execute();
}
* Constructor
* @param WebRequest $request A WebRequest object passed by reference
*/
- function LoginForm( &$request ) {
+ function LoginForm( &$request, $par = '' ) {
global $wgLang, $wgAllowRealName, $wgEnableEmail;
global $wgAuth;
- $this->mType = $request->getText( 'type' );
+ $this->mType = ( $par == 'signup' ) ? $par : $request->getText( 'type' ); # Check for [[Special:Userlogin/signup]]
$this->mName = $request->getText( 'wpName' );
$this->mPassword = $request->getText( 'wpPassword' );
$this->mRetype = $request->getText( 'wpRetype' );
$u->saveSettings();
$result = $this->mailPasswordInternal( $u, false, 'createaccount-title', 'createaccount-text' );
- wfRunHooks( 'AddNewAccount', array( $u ) );
+ wfRunHooks( 'AddNewAccount', array( $u, true ) );
$wgOut->setPageTitle( wfMsg( 'accmailtitle' ) );
$wgOut->setRobotpolicy( 'noindex,nofollow' );
if( WikiError::isError( $result ) ) {
$this->mainLoginForm( wfMsg( 'mailerror', $result->getMessage() ) );
} else {
- $wgOut->addWikiText( wfMsg( 'accmailtext', $u->getName(), $u->getEmail() ) );
+ $wgOut->addWikiMsg( 'accmailtext', $u->getName(), $u->getEmail() );
$wgOut->returnToMain( false );
}
$u = 0;
global $wgOut;
$error = $u->sendConfirmationMail();
if( WikiError::isError( $error ) ) {
- $wgOut->addWikiText( wfMsg( 'confirmemail_sendfailed', $error->getMessage() ) );
+ $wgOut->addWikiMsg( 'confirmemail_sendfailed', $error->getMessage() );
} else {
- $wgOut->addWikiText( wfMsg( 'confirmemail_oncreate' ) );
+ $wgOut->addWikiMsg( 'confirmemail_oncreate' );
}
}
return false;
} else {
# do not force a password for account creation by email
- # set pseudo password, it will be replaced later by a random generated password
- $this->mPassword = '-';
+ # set invalid password, it will be replaced later by a random generated password
+ $this->mPassword = null;
}
}
$this->mainLoginForm( wfMsg( 'wrongpassword' ) );
break;
case self::NOT_EXISTS:
- $this->mainLoginForm( wfMsg( 'nosuchuser', htmlspecialchars( $this->mName ) ) );
+ if( $wgUser->isAllowed( 'createaccount' ) ){
+ $this->mainLoginForm( wfMsg( 'nosuchuser', htmlspecialchars( $this->mName ) ) );
+ } else {
+ $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mName ) ) );
+ }
break;
case self::WRONG_PASS:
$this->mainLoginForm( wfMsg( 'wrongpassword' ) );
global $wgOut;
$wgOut->addWikiText( "<div class=\"errorbox\">$error</div>" );
$reset = new PasswordResetForm( $this->mName, $this->mPassword );
- $reset->execute();
+ $reset->execute( null );
}
/**
$wgOut->setRobotpolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
- $wgOut->addWikiText( wfMsg( 'whitelistacctext' ) );
+ $wgOut->addWikiMsg( 'whitelistacctext' );
$wgOut->returnToMain( false );
}
$blocker = User::whoIs( $wgUser->mBlock->mBy );
$block_reason = $wgUser->mBlock->mReason;
- $wgOut->addWikiText( wfMsg( 'cantcreateaccount-text', $ip, $block_reason, $blocker ) );
+ $wgOut->addWikiMsg( 'cantcreateaccount-text', $ip, $block_reason, $blocker );
$wgOut->returnToMain( false );
}
function throttleHit( $limit ) {
global $wgOut;
- $wgOut->addWikiText( wfMsg( 'acct_creation_throttle_hit', $limit ) );
+ $wgOut->addWikiMsg( 'acct_creation_throttle_hit', $limit );
}
/**
}
}
+