[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorAuthNeedsMultiFactorController 4 extends PhabricatorAuthController { 5 6 public function shouldRequireMultiFactorEnrollment() { 7 // Users need access to this controller in order to enroll in multi-factor 8 // auth. 9 return false; 10 } 11 12 public function processRequest() { 13 $request = $this->getRequest(); 14 $viewer = $request->getUser(); 15 16 $panel = id(new PhabricatorSettingsPanelMultiFactor()) 17 ->setUser($viewer) 18 ->setViewer($viewer) 19 ->setOverrideURI($this->getApplicationURI('/multifactor/')) 20 ->processRequest($request); 21 22 if ($panel instanceof AphrontResponse) { 23 return $panel; 24 } 25 26 $crumbs = $this->buildApplicationCrumbs(); 27 $crumbs->addTextCrumb(pht('Add Multi-Factor Auth')); 28 29 $viewer->updateMultiFactorEnrollment(); 30 31 if (!$viewer->getIsEnrolledInMultiFactor()) { 32 $help = id(new AphrontErrorView()) 33 ->setTitle(pht('Add Multi-Factor Authentication To Your Account')) 34 ->setSeverity(AphrontErrorView::SEVERITY_WARNING) 35 ->setErrors( 36 array( 37 pht( 38 'Before you can use Phabricator, you need to add multi-factor '. 39 'authentication to your account.'), 40 pht( 41 'Multi-factor authentication helps secure your account by '. 42 'making it more difficult for attackers to gain access or '. 43 'take senstive actions.'), 44 pht( 45 'To learn more about multi-factor authentication, click the '. 46 '%s button below.', 47 phutil_tag('strong', array(), pht('Help'))), 48 pht( 49 'To add an authentication factor, click the %s button below.', 50 phutil_tag('strong', array(), pht('Add Authentication Factor'))), 51 pht( 52 'To continue, add at least one authentication factor to your '. 53 'account.'), 54 )); 55 } else { 56 $help = id(new AphrontErrorView()) 57 ->setTitle(pht('Multi-Factor Authentication Configured')) 58 ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) 59 ->setErrors( 60 array( 61 pht( 62 'You have successfully configured multi-factor authentication '. 63 'for your account.'), 64 pht( 65 'You can make adjustments from the Settings panel later.'), 66 pht( 67 'When you are ready, %s.', 68 phutil_tag( 69 'strong', 70 array(), 71 phutil_tag( 72 'a', 73 array( 74 'href' => '/', 75 ), 76 pht('continue to Phabricator')))), 77 )); 78 } 79 80 return $this->buildApplicationPage( 81 array( 82 $crumbs, 83 $help, 84 $panel, 85 ), 86 array( 87 'title' => pht('Add Multi-Factor Authentication'), 88 )); 89 } 90 91 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |