Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F34634021
PhabricatorLogoutController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
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
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
if
(
$request
->
isFormPost
())
{
$log
=
PhabricatorUserLog
::
newLog
(
$user
,
$user
,
PhabricatorUserLog
::
ACTION_LOGOUT
);
$log
->
save
();
// 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
(
'phsid'
);
if
(
$phsid
)
{
$user
->
destroySession
(
$phsid
);
}
$request
->
clearCookie
(
'phsid'
);
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
'/login/'
);
}
if
(
$user
->
getPHID
())
{
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$user
)
->
setTitle
(
pht
(
'Log out of Phabricator?'
))
->
appendChild
(
'<p>'
.
pht
(
'Are you sure you want to log out?'
).
'</p>'
)
->
addSubmitButton
(
pht
(
'Logout'
))
->
addCancelButton
(
'/'
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
'/'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jan 20, 11:38 PM (1 d, 4 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ad/be/7ba51537b3bb010bb7503d7e67bc
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment