/** * logout the user from the session */ public function logout() { $this->manager->emit('\\OC\\User', 'logout'); $user = $this->getUser(); if (!is_null($user)) { try { $this->tokenProvider->invalidateToken($this->session->getId()); } catch (SessionNotAvailableException $ex) { } } $this->setUser(null); $this->setLoginName(null); $this->unsetMagicInCookie(); $this->session->clear(); }