Differential D21787 Diff 51943 src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php
Show First 20 Lines • Show All 203 Lines • ▼ Show 20 Lines | if ($is_authorized) { | ||||
// reviewing permissions, canceling the authorization, or aborting | // reviewing permissions, canceling the authorization, or aborting | ||||
// the workflow. | // the workflow. | ||||
$dialog = id(new AphrontDialogView()) | $dialog = id(new AphrontDialogView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setTitle(pht('Authenticate: %s', $name)) | ->setTitle(pht('Authenticate: %s', $name)) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'This application ("%s") is authorized to use your Phabricator '. | 'This application ("%s") is authorized to use your %s '. | ||||
'credentials. Continue to complete the authentication workflow.', | 'credentials. Continue to complete the authentication workflow.', | ||||
phutil_tag('strong', array(), $name))) | phutil_tag('strong', array(), $name), | ||||
PlatformSymbols::getPlatformServerName())) | |||||
->addCancelButton((string)$full_uri, pht('Continue to Application')); | ->addCancelButton((string)$full_uri, pht('Continue to Application')); | ||||
return id(new AphrontDialogResponse())->setDialog($dialog); | return id(new AphrontDialogResponse())->setDialog($dialog); | ||||
} | } | ||||
// Here, we're confirming authorization for the application. | // Here, we're confirming authorization for the application. | ||||
if ($authorization) { | if ($authorization) { | ||||
$missing_scope = array_diff_key($scope, $authorization->getScope()); | $missing_scope = array_diff_key($scope, $authorization->getScope()); | ||||
Show All 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$dialog = $this->newDialog() | $dialog = $this->newDialog() | ||||
->setShortTitle(pht('Authorize Access')) | ->setShortTitle(pht('Authorize Access')) | ||||
->setTitle(pht('Authorize "%s"?', $name)) | ->setTitle(pht('Authorize "%s"?', $name)) | ||||
->setSubmitURI($request->getRequestURI()->getPath()) | ->setSubmitURI($request->getRequestURI()->getPath()) | ||||
->setWidth(AphrontDialogView::WIDTH_FORM) | ->setWidth(AphrontDialogView::WIDTH_FORM) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'Do you want to authorize the external application "%s" to '. | 'Do you want to authorize the external application "%s" to '. | ||||
'access your Phabricator account data, including your primary '. | 'access your %s account data, including your primary '. | ||||
'email address?', | 'email address?', | ||||
phutil_tag('strong', array(), $name))) | phutil_tag('strong', array(), $name), | ||||
PlatformSymbols::getPlatformServerName())) | |||||
->appendForm($form) | ->appendForm($form) | ||||
->addSubmitButton(pht('Authorize Access')) | ->addSubmitButton(pht('Authorize Access')) | ||||
->addCancelButton((string)$cancel_uri, pht('Do Not Authorize')); | ->addCancelButton((string)$cancel_uri, pht('Do Not Authorize')); | ||||
if ($missing_scope) { | if ($missing_scope) { | ||||
$dialog->appendParagraph( | $dialog->appendParagraph( | ||||
pht( | pht( | ||||
'This application has requested these additional permissions. '. | 'This application has requested these additional permissions. '. | ||||
'Authorizing it will grant it the permissions it requests:')); | 'Authorizing it will grant it the permissions it requests:')); | ||||
foreach ($missing_scope as $scope_key => $ignored) { | foreach ($missing_scope as $scope_key => $ignored) { | ||||
// TODO: Once we introduce more scopes, explain them here. | // TODO: Once we introduce more scopes, explain them here. | ||||
} | } | ||||
} | } | ||||
$unknown_scope = array_diff_key($requested_scope, $scope); | $unknown_scope = array_diff_key($requested_scope, $scope); | ||||
if ($unknown_scope) { | if ($unknown_scope) { | ||||
$dialog->appendParagraph( | $dialog->appendParagraph( | ||||
pht( | pht( | ||||
'This application also requested additional unrecognized '. | 'This application also requested additional unrecognized '. | ||||
'permissions. These permissions may have existed in an older '. | 'permissions. These permissions may have existed in an older '. | ||||
'version of Phabricator, or may be from a future version of '. | 'version of the software, or may be from a future version of '. | ||||
'Phabricator. They will not be granted.')); | 'the software. They will not be granted.')); | ||||
$unknown_form = id(new AphrontFormView()) | $unknown_form = id(new AphrontFormView()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
->setLabel(pht('Unknown Scope')) | ->setLabel(pht('Unknown Scope')) | ||||
->setValue(implode(', ', array_keys($unknown_scope))) | ->setValue(implode(', ', array_keys($unknown_scope))) | ||||
->setDisabled(true)); | ->setDisabled(true)); | ||||
Show All 33 Lines |