Code Duplication    Length = 6-7 lines in 2 locations

lib/private/User/Session.php 2 locations

@@ 587-593 (lines=7) @@
584
		$afterEvent = new GenericEvent(null, ['loginType' => 'token', 'user' => $user, 'login' => $user->getUID(), 'password' => $password]);
585
		$this->eventDispatcher->dispatch('user.afterlogin', $afterEvent);
586
587
		if ($this->isLoggedIn()) {
588
			$this->prepareUserLogin();
589
		} else {
590
			// injecting l10n does not work - there is a circular dependency between session and \OCP\L10N\IFactory
591
			$message = \OC::$server->getL10N('lib')->t('Login canceled by app');
592
			throw new LoginException($message);
593
		}
594
595
		// set the app password
596
		$this->session->set('app_password', $token);
@@ 924-929 (lines=6) @@
921
922
			$this->manager->emit('\OC\User', 'postLogin', [$user, $password]);
923
924
			if ($this->isLoggedIn()) {
925
				$this->prepareUserLogin();
926
			} else {
927
				$message = \OC::$server->getL10N('lib')->t('Login canceled by app');
928
				throw new LoginException($message);
929
			}
930
931
			return true;
932
		}, ['before' => ['user' => $user, 'uid' => $uid, 'password' => $password],