Differential D20095 Diff 48004 src/applications/auth/controller/config/PhabricatorAuthEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/config/PhabricatorAuthEditController.php
<?php | <?php | ||||
final class PhabricatorAuthEditController | final class PhabricatorAuthEditController | ||||
extends PhabricatorAuthProviderConfigController { | extends PhabricatorAuthProviderConfigController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$this->requireApplicationCapability( | $this->requireApplicationCapability( | ||||
AuthManageProvidersCapability::CAPABILITY); | AuthManageProvidersCapability::CAPABILITY); | ||||
$viewer = $request->getUser(); | |||||
$provider_class = $request->getURIData('className'); | $viewer = $this->getViewer(); | ||||
$provider_class = $request->getStr('provider'); | |||||
$config_id = $request->getURIData('id'); | $config_id = $request->getURIData('id'); | ||||
if ($config_id) { | if ($config_id) { | ||||
$config = id(new PhabricatorAuthProviderConfigQuery()) | $config = id(new PhabricatorAuthProviderConfigQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | $str_auto_login = hsprintf( | ||||
'<strong>%s:</strong> %s', | '<strong>%s:</strong> %s', | ||||
pht('Allow Auto Login'), | pht('Allow Auto Login'), | ||||
pht( | pht( | ||||
'Phabricator will automatically login with this provider if it is '. | 'Phabricator will automatically login with this provider if it is '. | ||||
'the only available provider.')); | 'the only available provider.')); | ||||
$form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->addHiddenInput('provider', $provider_class) | |||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormCheckboxControl()) | id(new AphrontFormCheckboxControl()) | ||||
->setLabel(pht('Allow')) | ->setLabel(pht('Allow')) | ||||
->addCheckbox( | ->addCheckbox( | ||||
'allowLogin', | 'allowLogin', | ||||
1, | 1, | ||||
$str_login, | $str_login, | ||||
$v_login)) | $v_login)) | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |