Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81768171
PhabricatorConduitTokenHandshakeController.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, Sep 7, 20:22
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Sep 9, 20:22 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20614609
Attached To
rPH Phabricator
PhabricatorConduitTokenHandshakeController.php
View Options
<?php
final
class
PhabricatorConduitTokenHandshakeController
extends
PhabricatorConduitController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
id
(
new
PhabricatorAuthSessionEngine
())->
requireHighSecuritySession
(
$viewer
,
$request
,
'/'
);
$unguarded
=
AphrontWriteGuard
::
beginScopedUnguardedWrites
();
$token
=
PhabricatorConduitToken
::
initializeNewToken
(
$viewer
->
getPHID
(),
PhabricatorConduitToken
::
TYPE_COMMANDLINE
);
$token
->
save
();
unset
(
$unguarded
);
$form
=
id
(
new
AphrontFormView
())
->
setUser
(
$viewer
)
->
appendRemarkupInstructions
(
pht
(
'Copy-paste the API Token below to grant access to your account.'
))
->
appendChild
(
id
(
new
AphrontFormTextControl
())
->
setLabel
(
pht
(
'API Token'
))
->
setValue
(
$token
->
getToken
()))
->
appendRemarkupInstructions
(
pht
(
'This will authorize the requesting script to act on your behalf '
.
'permanently, like giving the script your account password.'
))
->
appendRemarkupInstructions
(
pht
(
'If you change your mind, you can revoke this token later in '
.
'{nav icon=wrench,name=Settings > Conduit API Tokens}.'
));
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Grant Account Access'
))
->
setWidth
(
AphrontDialogView
::
WIDTH_FULL
)
->
appendForm
(
$form
)
->
addCancelButton
(
'/'
);
}
}
Event Timeline
Log In to Comment