Differential D20008 Diff 47808 src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php
| <?php | <?php | ||||
| final class PhabricatorMultiFactorSettingsPanel | final class PhabricatorMultiFactorSettingsPanel | ||||
| extends PhabricatorSettingsPanel { | extends PhabricatorSettingsPanel { | ||||
| private $isEnrollment; | |||||
| public function getPanelKey() { | public function getPanelKey() { | ||||
| return 'multifactor'; | return 'multifactor'; | ||||
| } | } | ||||
| public function getPanelName() { | public function getPanelName() { | ||||
| return pht('Multi-Factor Auth'); | return pht('Multi-Factor Auth'); | ||||
| } | } | ||||
| public function getPanelMenuIcon() { | public function getPanelMenuIcon() { | ||||
| return 'fa-lock'; | return 'fa-lock'; | ||||
| } | } | ||||
| public function getPanelGroupKey() { | public function getPanelGroupKey() { | ||||
| return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY; | return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY; | ||||
| } | } | ||||
| public function isMultiFactorEnrollmentPanel() { | |||||
| return true; | |||||
| } | |||||
| public function setIsEnrollment($is_enrollment) { | |||||
| $this->isEnrollment = $is_enrollment; | |||||
| return $this; | |||||
| } | |||||
| public function getIsEnrollment() { | |||||
| return $this->isEnrollment; | |||||
| } | |||||
| public function processRequest(AphrontRequest $request) { | public function processRequest(AphrontRequest $request) { | ||||
| if ($request->getExists('new') || $request->getExists('providerPHID')) { | if ($request->getExists('new') || $request->getExists('providerPHID')) { | ||||
| return $this->processNew($request); | return $this->processNew($request); | ||||
| } | } | ||||
| if ($request->getExists('edit')) { | if ($request->getExists('edit')) { | ||||
| return $this->processEdit($request); | return $this->processEdit($request); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | $table->setDeviceVisibility( | ||||
| true, | true, | ||||
| )); | )); | ||||
| $help_uri = PhabricatorEnv::getDoclink( | $help_uri = PhabricatorEnv::getDoclink( | ||||
| 'User Guide: Multi-Factor Authentication'); | 'User Guide: Multi-Factor Authentication'); | ||||
| $buttons = array(); | $buttons = array(); | ||||
| // If we're enrolling a new account in MFA, provide a small visual hint | |||||
| // that this is the button they want to click. | |||||
| if ($this->getIsEnrollment()) { | |||||
| $add_color = PHUIButtonView::BLUE; | |||||
| } else { | |||||
| $add_color = PHUIButtonView::GREY; | |||||
| } | |||||
| $buttons[] = id(new PHUIButtonView()) | $buttons[] = id(new PHUIButtonView()) | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setIcon('fa-plus') | ->setIcon('fa-plus') | ||||
| ->setText(pht('Add Auth Factor')) | ->setText(pht('Add Auth Factor')) | ||||
| ->setHref($this->getPanelURI('?new=true')) | ->setHref($this->getPanelURI('?new=true')) | ||||
| ->setWorkflow(true) | ->setWorkflow(true) | ||||
| ->setColor(PHUIButtonView::GREY); | ->setColor($add_color); | ||||
| $buttons[] = id(new PHUIButtonView()) | $buttons[] = id(new PHUIButtonView()) | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setIcon('fa-book') | ->setIcon('fa-book') | ||||
| ->setText(pht('Help')) | ->setText(pht('Help')) | ||||
| ->setHref($help_uri) | ->setHref($help_uri) | ||||
| ->setColor(PHUIButtonView::GREY); | ->setColor(PHUIButtonView::GREY); | ||||
| ▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines | |||||