Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/PhabricatorLogoutController.php
Show All 28 Lines | if ($request->isFormPost()) { | ||||
PhabricatorUserLog::ACTION_LOGOUT); | PhabricatorUserLog::ACTION_LOGOUT); | ||||
$log->save(); | $log->save(); | ||||
// Destroy the user's session in the database so logout works even if | // Destroy the user's session in the database so logout works even if | ||||
// their cookies have some issues. We'll detect cookie issues when they | // their cookies have some issues. We'll detect cookie issues when they | ||||
// try to login again and tell them to clear any junk. | // try to login again and tell them to clear any junk. | ||||
$phsid = $request->getCookie('phsid'); | $phsid = $request->getCookie('phsid'); | ||||
if ($phsid) { | if ($phsid) { | ||||
$user->destroySession($phsid); | $session = id(new PhabricatorAuthSessionQuery()) | ||||
->setViewer($user) | |||||
->withSessionKeys(array($phsid)) | |||||
->executeOne(); | |||||
if ($session) { | |||||
$session->delete(); | |||||
} | |||||
} | } | ||||
$request->clearCookie('phsid'); | $request->clearCookie('phsid'); | ||||
return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
->setURI('/login/'); | ->setURI('/login/'); | ||||
} | } | ||||
if ($user->getPHID()) { | if ($user->getPHID()) { | ||||
Show All 15 Lines |