Code Duplication    Length = 7-8 lines in 2 locations

lib/private/User/Session.php 2 locations

@@ 497-504 (lines=8) @@
494
			$this->setToken(null);
495
			$firstTimeLogin = $user->updateLastLoginTimestamp();
496
			$this->manager->emit('\OC\User', 'postLogin', [$user, $password]);
497
			if ($this->isLoggedIn()) {
498
				$this->prepareUserLogin($firstTimeLogin);
499
				return true;
500
			} else {
501
				// injecting l10n does not work - there is a circular dependency between session and \OCP\L10N\IFactory
502
				$message = \OC::$server->getL10N('lib')->t('Login canceled by app');
503
				throw new LoginException($message);
504
			}
505
		} else {
506
			// injecting l10n does not work - there is a circular dependency between session and \OCP\L10N\IFactory
507
			$message = \OC::$server->getL10N('lib')->t('User disabled');
@@ 554-560 (lines=7) @@
551
		\OC::$server->getLockdownManager()->setToken($dbToken);
552
		$this->manager->emit('\OC\User', 'postLogin', array($user, $password));
553
554
		if ($this->isLoggedIn()) {
555
			$this->prepareUserLogin(false); // token login cant be the first
556
		} else {
557
			// injecting l10n does not work - there is a circular dependency between session and \OCP\L10N\IFactory
558
			$message = \OC::$server->getL10N('lib')->t('Login canceled by app');
559
			throw new LoginException($message);
560
		}
561
562
		return true;
563
	}