Completed
Pull Request — master (#4710)
by Robin
14:56
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);
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
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			}
490 490
 
491 491
 			// trigger any other initialization
492
-			\OC::$server->getEventDispatcher()->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser()));
492
+			\OC::$server->getEventDispatcher()->dispatch(IUser::class.'::firstLogin', new GenericEvent($this->getUser()));
493 493
 		}
494 494
 	}
495 495
 
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 	private function checkTokenCredentials(IToken $dbToken, $token) {
650 650
 		// Check whether login credentials are still valid and the user was not disabled
651 651
 		// This check is performed each 5 minutes
652
-		$lastCheck = $dbToken->getLastCheck() ? : 0;
652
+		$lastCheck = $dbToken->getLastCheck() ?: 0;
653 653
 		$now = $this->timeFactory->getTime();
654 654
 		if ($lastCheck > ($now - 60 * 5)) {
655 655
 			// Checked performed recently, nothing to do now
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 		if (!$this->loginWithToken($token)) {
740 740
 			return false;
741 741
 		}
742
-		if(!$this->validateToken($token)) {
742
+		if (!$this->validateToken($token)) {
743 743
 			return false;
744 744
 		}
745 745
 		return true;
@@ -864,9 +864,9 @@  discard block
 block discarded – undo
864 864
 		setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT, '', $secureCookie, true);
865 865
 		// old cookies might be stored under /webroot/ instead of /webroot
866 866
 		// and Firefox doesn't like it!
867
-		setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true);
868
-		setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true);
869
-		setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true);
867
+		setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true);
868
+		setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true);
869
+		setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true);
870 870
 	}
871 871
 
872 872
 	/**
Please login to merge, or discard this patch.