Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F439264
PassphraseCredentialPublicController.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
PassphraseCredentialPublicController.php
View Options
<?php
final
class
PassphraseCredentialPublicController
extends
PassphraseController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$credential
=
id
(
new
PassphraseCredentialQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
))
->
executeOne
();
if
(!
$credential
)
{
return
new
Aphront404Response
();
}
$type
=
PassphraseCredentialType
::
getTypeByConstant
(
$credential
->
getCredentialType
());
if
(!
$type
)
{
throw
new
Exception
(
pht
(
'Credential has invalid type "%s"!'
,
$type
));
}
if
(!
$type
->
hasPublicKey
())
{
throw
new
Exception
(
pht
(
'Credential has no public key!'
));
}
$view_uri
=
'/'
.
$credential
->
getMonogram
();
$public_key
=
$type
->
getPublicKey
(
$viewer
,
$credential
);
$body
=
id
(
new
PHUIFormLayoutView
())
->
appendChild
(
id
(
new
AphrontFormTextAreaControl
())
->
setLabel
(
pht
(
'Public Key'
))
->
setReadOnly
(
true
)
->
setValue
(
$public_key
));
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$viewer
)
->
setWidth
(
AphrontDialogView
::
WIDTH_FORM
)
->
setTitle
(
pht
(
'Public Key (%s)'
,
$credential
->
getMonogram
()))
->
appendChild
(
$body
)
->
addCancelButton
(
$view_uri
,
pht
(
'Done'
));
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 3:49 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63670
Default Alt Text
PassphraseCredentialPublicController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment