|
@@ -351,14 +351,14 @@ discard block |
|
|
block discarded – undo |
|
351
|
351
|
throw new LoginException($message); |
|
352
|
352
|
} |
|
353
|
353
|
|
|
354
|
|
- if($regenerateSessionId) { |
|
|
354
|
+ if ($regenerateSessionId) { |
|
355
|
355
|
$this->session->regenerateId(); |
|
356
|
356
|
} |
|
357
|
357
|
|
|
358
|
358
|
$this->setUser($user); |
|
359
|
359
|
$this->setLoginName($loginDetails['loginName']); |
|
360
|
360
|
|
|
361
|
|
- if(isset($loginDetails['token']) && $loginDetails['token'] instanceof IToken) { |
|
|
361
|
+ if (isset($loginDetails['token']) && $loginDetails['token'] instanceof IToken) { |
|
362
|
362
|
$this->setToken($loginDetails['token']->getId()); |
|
363
|
363
|
$this->lockdownManager->setToken($loginDetails['token']); |
|
364
|
364
|
$firstTimeLogin = false; |
|
@@ -367,7 +367,7 @@ discard block |
|
|
block discarded – undo |
|
367
|
367
|
$firstTimeLogin = $user->updateLastLoginTimestamp(); |
|
368
|
368
|
} |
|
369
|
369
|
$this->manager->emit('\OC\User', 'postLogin', [$user, $loginDetails['password']]); |
|
370
|
|
- if($this->isLoggedIn()) { |
|
|
370
|
+ if ($this->isLoggedIn()) { |
|
371
|
371
|
$this->prepareUserLogin($firstTimeLogin, $regenerateSessionId); |
|
372
|
372
|
return true; |
|
373
|
373
|
} else { |
|
@@ -415,13 +415,13 @@ discard block |
|
|
block discarded – undo |
|
415
|
415
|
} |
|
416
|
416
|
|
|
417
|
417
|
// Try to login with this username and password |
|
418
|
|
- if (!$this->login($user, $password) ) { |
|
|
418
|
+ if (!$this->login($user, $password)) { |
|
419
|
419
|
|
|
420
|
420
|
// Failed, maybe the user used their email address |
|
421
|
421
|
$users = $this->manager->getByEmail($user); |
|
422
|
422
|
if (!(\count($users) === 1 && $this->login($users[0]->getUID(), $password))) { |
|
423
|
423
|
|
|
424
|
|
- $this->logger->warning('Login failed: \'' . $user . '\' (Remote IP: \'' . \OC::$server->getRequest()->getRemoteAddress() . '\')', ['app' => 'core']); |
|
|
424
|
+ $this->logger->warning('Login failed: \''.$user.'\' (Remote IP: \''.\OC::$server->getRequest()->getRemoteAddress().'\')', ['app' => 'core']); |
|
425
|
425
|
|
|
426
|
426
|
$throttler->registerAttempt('login', $request->getRemoteAddress(), ['uid' => $user]); |
|
427
|
427
|
if ($currentDelay === 0) { |
|
@@ -433,7 +433,7 @@ discard block |
|
|
block discarded – undo |
|
433
|
433
|
|
|
434
|
434
|
if ($isTokenPassword) { |
|
435
|
435
|
$this->session->set('app_password', $password); |
|
436
|
|
- } else if($this->supportsCookies($request)) { |
|
|
436
|
+ } else if ($this->supportsCookies($request)) { |
|
437
|
437
|
// Password login, but cookies supported -> create (browser) session token |
|
438
|
438
|
$this->createSessionToken($request, $this->getUser()->getUID(), $user, $password); |
|
439
|
439
|
} |
|
@@ -516,7 +516,7 @@ discard block |
|
|
block discarded – undo |
|
516
|
516
|
} |
|
517
|
517
|
|
|
518
|
518
|
// trigger any other initialization |
|
519
|
|
- \OC::$server->getEventDispatcher()->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); |
|
|
519
|
+ \OC::$server->getEventDispatcher()->dispatch(IUser::class.'::firstLogin', new GenericEvent($this->getUser())); |
|
520
|
520
|
} |
|
521
|
521
|
} |
|
522
|
522
|
|
|
@@ -678,7 +678,7 @@ discard block |
|
|
block discarded – undo |
|
678
|
678
|
private function checkTokenCredentials(IToken $dbToken, $token) { |
|
679
|
679
|
// Check whether login credentials are still valid and the user was not disabled |
|
680
|
680
|
// This check is performed each 5 minutes |
|
681
|
|
- $lastCheck = $dbToken->getLastCheck() ? : 0; |
|
|
681
|
+ $lastCheck = $dbToken->getLastCheck() ?: 0; |
|
682
|
682
|
$now = $this->timeFactory->getTime(); |
|
683
|
683
|
if ($lastCheck > ($now - 60 * 5)) { |
|
684
|
684
|
// Checked performed recently, nothing to do now |
|
@@ -771,7 +771,7 @@ discard block |
|
|
block discarded – undo |
|
771
|
771
|
if (!$this->loginWithToken($token)) { |
|
772
|
772
|
return false; |
|
773
|
773
|
} |
|
774
|
|
- if(!$this->validateToken($token)) { |
|
|
774
|
+ if (!$this->validateToken($token)) { |
|
775
|
775
|
return false; |
|
776
|
776
|
} |
|
777
|
777
|
|
|
@@ -906,9 +906,9 @@ discard block |
|
|
block discarded – undo |
|
906
|
906
|
setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT, '', $secureCookie, true); |
|
907
|
907
|
// old cookies might be stored under /webroot/ instead of /webroot |
|
908
|
908
|
// and Firefox doesn't like it! |
|
909
|
|
- setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true); |
|
910
|
|
- setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true); |
|
911
|
|
- setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT . '/', '', $secureCookie, true); |
|
|
909
|
+ setcookie('nc_username', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true); |
|
|
910
|
+ setcookie('nc_token', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true); |
|
|
911
|
+ setcookie('nc_session_id', '', $this->timeFactory->getTime() - 3600, OC::$WEBROOT.'/', '', $secureCookie, true); |
|
912
|
912
|
} |
|
913
|
913
|
|
|
914
|
914
|
/** |