Code Duplication    Length = 7-9 lines in 2 locations

includes/auth/AuthManager.php 2 locations

@@ 1103-1109 (lines=7) @@
1100
			// Step 0: Prepare and validate the input
1101
1102
			$user = User::newFromName( $state['username'], 'creatable' );
1103
			if ( !is_object( $user ) ) {
1104
				$session->remove( 'AuthManager::accountCreationState' );
1105
				$this->logger->debug( __METHOD__ . ': Invalid username', [
1106
					'user' => $state['username'],
1107
				] );
1108
				return AuthenticationResponse::newFail( wfMessage( 'noname' ) );
1109
			}
1110
1111
			if ( $state['creatorid'] ) {
1112
				$creator = User::newFromId( $state['creatorid'] );
@@ 1121-1129 (lines=9) @@
1118
			// Avoid account creation races on double submissions
1119
			$cache = \ObjectCache::getLocalClusterInstance();
1120
			$lock = $cache->getScopedLock( $cache->makeGlobalKey( 'account', md5( $user->getName() ) ) );
1121
			if ( !$lock ) {
1122
				// Don't clear AuthManager::accountCreationState for this code
1123
				// path because the process that won the race owns it.
1124
				$this->logger->debug( __METHOD__ . ': Could not acquire account creation lock', [
1125
					'user' => $user->getName(),
1126
					'creator' => $creator->getName(),
1127
				] );
1128
				return AuthenticationResponse::newFail( wfMessage( 'usernameinprogress' ) );
1129
			}
1130
1131
			// Permissions check
1132
			$status = $this->checkAccountCreatePermissions( $creator );