Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4238
1.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:54 PM
2014-11-21 21:54:30 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
1.patch
View Options
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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3803
Default Alt Text
1.patch (2 KB)
Attached To
Mode
T13148: Users can login with global account and create an account in a wiki even if IP is blocked from account creations
Attached
Detach File
Event Timeline
Log In to Comment