Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106656318
PhabricatorLogoutController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 29, 11:59
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Mar 31, 12:59 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25245992
Attached To
rPH Phabricator
PhabricatorLogoutController.php
View Options
<?php
final
class
PhabricatorLogoutController
extends
PhabricatorAuthController
{
public
function
shouldRequireLogin
()
{
return
true
;
}
public
function
shouldRequireEmailVerification
()
{
// Allow unverified users to logout.
return
false
;
}
public
function
shouldRequireEnabledUser
()
{
// Allow disabled users to logout.
return
false
;
}
public
function
shouldAllowPartialSessions
()
{
return
true
;
}
public
function
shouldAllowLegallyNonCompliantUsers
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
if
(
$request
->
isFormPost
())
{
// 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
// try to login again and tell them to clear any junk.
$phsid
=
$request
->
getCookie
(
PhabricatorCookies
::
COOKIE_SESSION
);
if
(
strlen
(
$phsid
))
{
$session
=
id
(
new
PhabricatorAuthSessionQuery
())
->
setViewer
(
$viewer
)
->
withSessionKeys
(
array
(
$phsid
))
->
executeOne
();
if
(
$session
)
{
$engine
=
new
PhabricatorAuthSessionEngine
();
$engine
->
logoutSession
(
$viewer
,
$session
);
}
}
$request
->
clearCookie
(
PhabricatorCookies
::
COOKIE_SESSION
);
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
'/auth/loggedout/'
);
}
if
(
$viewer
->
getPHID
())
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Log Out?'
))
->
appendChild
(
pht
(
'Are you sure you want to log out?'
))
->
addSubmitButton
(
pht
(
'Log Out'
))
->
addCancelButton
(
'/'
);
}
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
'/'
);
}
}
Event Timeline
Log In to Comment