* New parameter for AbortCreateAccount: (whether the account is being autocreated). Used in CentralAuth.
'AbortNewAccount': Return false to cancel account creation.
$user: the User object about to be created (read-only, incomplete)
$message: out parameter: error message to display on abort
'AbortNewAccount': Return false to cancel account creation.
$user: the User object about to be created (read-only, incomplete)
$message: out parameter: error message to display on abort
+$autocreate: whether the account is being automatically created.
'AddNewAccount': after a user account is created
$user: the User object that was created. (Parameter added in 1.7)
'AddNewAccount': after a user account is created
$user: the User object that was created. (Parameter added in 1.7)
$u->setRealName( $this->mRealName );
$abortError = '';
$u->setRealName( $this->mRealName );
$abortError = '';
- if( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) {
+ if( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError, false /* autocreate */ ) ) ) {
// Hook point to add extra creation throttles and blocks
wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
$this->mainLoginForm( $abortError );
// Hook point to add extra creation throttles and blocks
wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
$this->mainLoginForm( $abortError );
- function authenticateUserData() {
+ function authenticateUserData(&$error_extra) {
global $wgUser, $wgAuth;
if ( '' == $this->mName ) {
return self::NO_NAME;
global $wgUser, $wgAuth;
if ( '' == $this->mName ) {
return self::NO_NAME;
$isAutoCreated = false;
if ( 0 == $u->getID() ) {
$isAutoCreated = false;
if ( 0 == $u->getID() ) {
- $status = $this->attemptAutoCreate( $u );
+ $status = $this->attemptAutoCreate( $u, &$error_extra );
if ( $status !== self::SUCCESS ) {
return $status;
} else {
if ( $status !== self::SUCCESS ) {
return $status;
} else {
* Only succeeds if there is an external authentication method which allows it.
* @return integer Status code
*/
* Only succeeds if there is an external authentication method which allows it.
* @return integer Status code
*/
- function attemptAutoCreate( $user ) {
+ function attemptAutoCreate( $user, &$error_extra ) {
global $wgAuth, $wgUser;
/**
* If the external authentication plugin allows it,
global $wgAuth, $wgUser;
/**
* If the external authentication plugin allows it,
return self::NOT_EXISTS;
}
if ( !$wgAuth->userExists( $user->getName() ) ) {
return self::NOT_EXISTS;
}
if ( !$wgAuth->userExists( $user->getName() ) ) {
+ die("Doesn't exist: ".$user->getName());
wfDebug( __METHOD__.": user does not exist\n" );
return self::NOT_EXISTS;
}
wfDebug( __METHOD__.": user does not exist\n" );
return self::NOT_EXISTS;
}
wfDebug( __METHOD__.": user is blocked from account creation\n" );
return self::CREATE_BLOCKED;
}
wfDebug( __METHOD__.": user is blocked from account creation\n" );
return self::CREATE_BLOCKED;
}
+
+ $abortError = '';
+ if( !wfRunHooks( 'AbortNewAccount', array( $user, &$abortError, true /* autocreate */ ) ) ) {
+ // Hook point to add extra creation throttles and blocks
+ wfDebug( __METHOD__.": a hook blocked creation\n" );
+ $error_extra = $abortError;
+ return self::ABORTED;
+ }
wfDebug( __METHOD__.": creating account\n" );
$user = $this->initUser( $user, true );
wfDebug( __METHOD__.": creating account\n" );
$user = $this->initUser( $user, true );
function processLogin() {
global $wgUser, $wgAuth;
function processLogin() {
global $wgUser, $wgAuth;
- switch ($this->authenticateUserData())
+ $error_extra = '';
+ switch ($this->authenticateUserData(&$error_extra))
{
case self::SUCCESS:
# We've verified now, update the real record
{
case self::SUCCESS:
# We've verified now, update the real record
case self::CREATE_BLOCKED:
$this->userBlockedMessage();
break;
case self::CREATE_BLOCKED:
$this->userBlockedMessage();
break;
+ case self::ABORTED:
+ $this->mainLoginForm( $error_extra );
+ break;
default:
throw new MWException( "Unhandled case value" );
}
default:
throw new MWException( "Unhandled case value" );
}