diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/User/Session.php | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/User/Session.php')
-rw-r--r-- | lib/private/User/Session.php | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index d908a3d78b2..817dcbf4c33 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -321,9 +321,7 @@ class Session implements IUserSession, Emitter { * @return null|string */ public function getImpersonatingUserID(): ?string { - return $this->session->get('oldUserId'); - } public function setImpersonatingUserID(bool $useCurrentUser = true): void { @@ -338,7 +336,6 @@ class Session implements IUserSession, Emitter { throw new \OC\User\NoUserException(); } $this->session->set('oldUserId', $currentUser->getUID()); - } /** * set the token id @@ -384,7 +381,7 @@ class Session implements IUserSession, Emitter { throw new LoginException($message); } - if($regenerateSessionId) { + if ($regenerateSessionId) { $this->session->regenerateId(); } @@ -411,7 +408,7 @@ class Session implements IUserSession, Emitter { $loginDetails['password'], $isToken, ]); - if($this->isLoggedIn()) { + if ($this->isLoggedIn()) { $this->prepareUserLogin($firstTimeLogin, $regenerateSessionId); return true; } @@ -464,7 +461,6 @@ class Session implements IUserSession, Emitter { // Failed, maybe the user used their email address $users = $this->manager->getByEmail($user); if (!(\count($users) === 1 && $this->login($users[0]->getUID(), $password))) { - $this->logger->warning('Login failed: \'' . $user . '\' (Remote IP: \'' . \OC::$server->getRequest()->getRemoteAddress() . '\')', ['app' => 'core']); $throttler->registerAttempt('login', $request->getRemoteAddress(), ['user' => $user]); @@ -480,7 +476,7 @@ class Session implements IUserSession, Emitter { if ($isTokenPassword) { $this->session->set('app_password', $password); - } elseif($this->supportsCookies($request)) { + } elseif ($this->supportsCookies($request)) { // Password login, but cookies supported -> create (browser) session token $this->createSessionToken($request, $this->getUser()->getUID(), $user, $password); } @@ -592,7 +588,7 @@ class Session implements IUserSession, Emitter { ); // Set the last-password-confirm session to make the sudo mode work - $this->session->set('last-password-confirm', $this->timeFactory->getTime()); + $this->session->set('last-password-confirm', $this->timeFactory->getTime()); return true; } @@ -825,7 +821,7 @@ class Session implements IUserSession, Emitter { if (!$this->loginWithToken($token)) { return false; } - if(!$this->validateToken($token)) { + if (!$this->validateToken($token)) { return false; } @@ -910,7 +906,6 @@ class Session implements IUserSession, Emitter { try { $this->tokenProvider->invalidateToken($this->session->getId()); } catch (SessionNotAvailableException $ex) { - } } $this->setUser(null); @@ -1011,6 +1006,4 @@ class Session implements IUserSession, Emitter { public function updateTokens(string $uid, string $password) { $this->tokenProvider->updatePasswords($uid, $password); } - - } |