Code Duplication    Length = 5-9 lines in 2 locations

includes/specialpage/LoginSignupSpecialPage.php 1 location

@@ 228-232 (lines=5) @@
225
226
		// Make sure the system configuration allows log in / sign up
227
		if ( !$this->isSignup() && !$authManager->canAuthenticateNow() ) {
228
			if ( !$session->canSetUser() ) {
229
				throw new ErrorPageError( 'cannotloginnow-title', 'cannotloginnow-text', [
230
					$session->getProvider()->describe( RequestContext::getMain()->getLanguage() )
231
				] );
232
			}
233
			throw new ErrorPageError( 'cannotlogin-title', 'cannotlogin-text' );
234
		} elseif ( $this->isSignup() && !$authManager->canCreateAccounts() ) {
235
			throw new ErrorPageError( 'cannotcreateaccount-title', 'cannotcreateaccount-text' );

includes/specials/SpecialUserLogout.php 1 location

@@ 53-61 (lines=9) @@
50
51
		// Make sure it's possible to log out
52
		$session = MediaWiki\Session\SessionManager::getGlobalSession();
53
		if ( !$session->canSetUser() ) {
54
			throw new ErrorPageError(
55
				'cannotlogoutnow-title',
56
				'cannotlogoutnow-text',
57
				[
58
					$session->getProvider()->describe( RequestContext::getMain()->getLanguage() )
59
				]
60
			);
61
		}
62
63
		$user = $this->getUser();
64
		$oldName = $user->getName();