Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F428640
PhabricatorOAuthUnlinkController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorOAuthUnlinkController.php
View Options
<?php
final
class
PhabricatorOAuthUnlinkController
extends
PhabricatorAuthController
{
private
$provider
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
provider
=
PhabricatorOAuthProvider
::
newProvider
(
$data
[
'provider'
]);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$provider
=
$this
->
provider
;
if
(
$provider
->
isProviderLinkPermanent
())
{
throw
new
Exception
(
pht
(
"You may not unlink accounts from this OAuth provider."
));
}
$provider_key
=
$provider
->
getProviderKey
();
$oauth_info
=
id
(
new
PhabricatorUserOAuthInfo
())->
loadOneWhere
(
'userID = %d AND oauthProvider = %s'
,
$user
->
getID
(),
$provider_key
);
if
(!
$oauth_info
)
{
return
new
Aphront400Response
();
}
if
(!
$request
->
isDialogFormPost
())
{
$dialog
=
new
AphrontDialogView
();
$dialog
->
setUser
(
$user
);
$dialog
->
setTitle
(
pht
(
'Really unlink account?'
));
$dialog
->
appendChild
(
phutil_tag
(
'p'
,
array
(),
pht
(
'You will not be able to login using this account '
.
'once you unlink it. Continue?'
)));
$dialog
->
addSubmitButton
(
pht
(
'Unlink Account'
));
$dialog
->
addCancelButton
(
$provider
->
getSettingsPanelURI
());
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
$oauth_info
->
delete
();
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
$provider
->
getSettingsPanelURI
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 6:57 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
59223
Default Alt Text
PhabricatorOAuthUnlinkController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment