Page MenuHomePhabricator
Authored By
bzimport
Nov 21 2014, 9:54 PM
Size
2 KB
Referenced Files
None
Subscribers
None
Index: includes/SpecialUserlogin.php
===================================================================
--- includes/SpecialUserlogin.php (revision 27826)
+++ includes/SpecialUserlogin.php (working copy)
@@ -32,6 +32,7 @@
const EMPTY_PASS = 6;
const RESET_PASS = 7;
const ABORTED = 8;
+ const NO_AUTOCREATE = 9;
var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted;
var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword;
@@ -196,9 +197,10 @@
}
/**
+ * @param $autocreate boolean -- true if this is an autocreation via auth plugin
* @private
*/
- function addNewAccountInternal() {
+ function addNewAccountInternal( $autocreate = false ) {
global $wgUser, $wgOut;
global $wgEnableSorbs, $wgProxyWhitelist;
global $wgMemc, $wgAccountCreationThrottle;
@@ -317,7 +319,7 @@
return false;
}
- return $this->initUser( $u, false );
+ return $this->initUser( $u, $autocreate );
}
/**
@@ -365,6 +367,7 @@
*/
function authenticateUserData() {
global $wgUser, $wgAuth;
+ $autocreate = false;
if ( '' == $this->mName ) {
return self::NO_NAME;
}
@@ -381,7 +384,12 @@
*/
if ( $wgAuth->autoCreate() && $wgAuth->userExists( $u->getName() ) ) {
if ( $wgAuth->authenticate( $u->getName(), $this->mPassword ) ) {
- $u = $this->initUser( $u, true );
+ $this->mRetype = $this->mPassword; # Avoid the error "passwords don't match"
+ $u = $this->addNewAccountInternal( true );
+ if ( !$u ) {
+ return self::NO_AUTOCREATE;
+ }
+ $autocreate = true;
} else {
return self::WRONG_PLUGIN_PASS;
}
@@ -438,6 +446,9 @@
$retval = self::SUCCESS;
}
wfRunHooks( 'LoginAuthenticateAudit', array( $u, $this->mPassword, $retval ) );
+ if ( $autocreate ) {
+ wfRunHooks( 'AddNewAccount', array( $u ) );
+ }
return $retval;
}
@@ -482,6 +493,8 @@
case self::RESET_PASS:
$this->resetLoginForm( wfMsg( 'resetpass_announce' ) );
break;
+ case self::NO_AUTOCREATE:
+ break;
default:
wfDebugDieBacktrace( "Unhandled case value" );
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3803
Default Alt Text
1.patch (2 KB)

Event Timeline