Completed
Pull Request — master (#6360)
by Christoph
14:02
created
lib/private/User/Session.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
 			throw new LoginException($message);
342 342
 		}
343 343
 
344
-		if($regenerateSessionId) {
344
+		if ($regenerateSessionId) {
345 345
 			$this->session->regenerateId();
346 346
 		}
347 347
 
348 348
 		$this->setUser($user);
349 349
 		$this->setLoginName($loginDetails['loginName']);
350 350
 
351
-		if(isset($loginDetails['token']) && $loginDetails['token'] instanceof IToken) {
351
+		if (isset($loginDetails['token']) && $loginDetails['token'] instanceof IToken) {
352 352
 			$this->setToken($loginDetails['token']->getId());
353 353
 			$this->lockdownManager->setToken($loginDetails['token']);
354 354
 			$firstTimeLogin = false;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			$firstTimeLogin = $user->updateLastLoginTimestamp();
358 358
 		}
359 359
 		$this->manager->emit('\OC\User', 'postLogin', [$user, $loginDetails['password']]);
360
-		if($this->isLoggedIn()) {
360
+		if ($this->isLoggedIn()) {
361 361
 			$this->prepareUserLogin($firstTimeLogin, $regenerateSessionId);
362 362
 			return true;
363 363
 		} else {
@@ -397,14 +397,14 @@  discard block
 block discarded – undo
397 397
 		if (!$isTokenPassword && $this->isTwoFactorEnforced($user)) {
398 398
 			throw new PasswordLoginForbiddenException();
399 399
 		}
400
-		if (!$this->login($user, $password) ) {
400
+		if (!$this->login($user, $password)) {
401 401
 			$users = $this->manager->getByEmail($user);
402 402
 			if (count($users) === 1) {
403 403
 				return $this->login($users[0]->getUID(), $password);
404 404
 			}
405 405
 
406 406
 			$throttler->registerAttempt('login', $request->getRemoteAddress(), ['uid' => $user]);
407
-			if($currentDelay === 0) {
407
+			if ($currentDelay === 0) {
408 408
 				$throttler->sleepDelay($request->getRemoteAddress(), 'login');
409 409
 			}
410 410
 			return false;
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 
413 413
 		if ($isTokenPassword) {
414 414
 			$this->session->set('app_password', $password);
415
-		} else if($this->supportsCookies($request)) {
415
+		} else if ($this->supportsCookies($request)) {
416 416
 			// Password login, but cookies supported -> create (browser) session token
417 417
 			$this->createSessionToken($request, $this->getUser()->getUID(), $user, $password);
418 418
 		}
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 			}
493 493
 
494 494
 			// trigger any other initialization
495
-			\OC::$server->getEventDispatcher()->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser()));
495
+			\OC::$server->getEventDispatcher()->dispatch(IUser::class.'::firstLogin', new GenericEvent($this->getUser()));
496 496
 		}
497 497
 	}
498 498
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	private function checkTokenCredentials(IToken $dbToken, $token) {
653 653
 		// Check whether login credentials are still valid and the user was not disabled
654 654
 		// This check is performed each 5 minutes
655
-		$lastCheck = $dbToken->getLastCheck() ? : 0;
655
+		$lastCheck = $dbToken->getLastCheck() ?: 0;
656 656
 		$now = $this->timeFactory->getTime();
657 657
 		if ($lastCheck > ($now - 60 * 5)) {
658 658
 			// Checked performed recently, nothing to do now
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 		if (!$this->loginWithToken($token)) {
743 743
 			return false;
744 744
 		}
745
-		if(!$this->validateToken($token)) {
745
+		if (!$this->validateToken($token)) {
746 746
 			return false;
747 747
 		}
748 748
 		return true;
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
 		setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT, '', $secureCookie, true);
874 874
 		// old cookies might be stored under /webroot/ instead of /webroot
875 875
 		// and Firefox doesn't like it!
876
-		setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true);
877
-		setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true);
878
-		setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true);
876
+		setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true);
877
+		setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true);
878
+		setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true);
879 879
 	}
880 880
 
881 881
 	/**
Please login to merge, or discard this patch.