|
@@ 1112-1118 (lines=7) @@
|
| 1109 |
|
// Step 0: Prepare and validate the input |
| 1110 |
|
|
| 1111 |
|
$user = User::newFromName( $state['username'], 'creatable' ); |
| 1112 |
|
if ( !is_object( $user ) ) { |
| 1113 |
|
$session->remove( 'AuthManager::accountCreationState' ); |
| 1114 |
|
$this->logger->debug( __METHOD__ . ': Invalid username', [ |
| 1115 |
|
'user' => $state['username'], |
| 1116 |
|
] ); |
| 1117 |
|
return AuthenticationResponse::newFail( wfMessage( 'noname' ) ); |
| 1118 |
|
} |
| 1119 |
|
|
| 1120 |
|
if ( $state['creatorid'] ) { |
| 1121 |
|
$creator = User::newFromId( $state['creatorid'] ); |
|
@@ 1130-1138 (lines=9) @@
|
| 1127 |
|
// Avoid account creation races on double submissions |
| 1128 |
|
$cache = \ObjectCache::getLocalClusterInstance(); |
| 1129 |
|
$lock = $cache->getScopedLock( $cache->makeGlobalKey( 'account', md5( $user->getName() ) ) ); |
| 1130 |
|
if ( !$lock ) { |
| 1131 |
|
// Don't clear AuthManager::accountCreationState for this code |
| 1132 |
|
// path because the process that won the race owns it. |
| 1133 |
|
$this->logger->debug( __METHOD__ . ': Could not acquire account creation lock', [ |
| 1134 |
|
'user' => $user->getName(), |
| 1135 |
|
'creator' => $creator->getName(), |
| 1136 |
|
] ); |
| 1137 |
|
return AuthenticationResponse::newFail( wfMessage( 'usernameinprogress' ) ); |
| 1138 |
|
} |
| 1139 |
|
|
| 1140 |
|
// Permissions check |
| 1141 |
|
$status = $this->checkAccountCreatePermissions( $creator ); |