@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 48 lines 1.5 kB view raw
1<?php 2 3final class PhabricatorAuthDowngradeSessionController 4 extends PhabricatorAuthController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $this->getViewer(); 8 9 $panel_uri = '/settings/panel/sessions/'; 10 11 $session = $viewer->getSession(); 12 if ($session->getHighSecurityUntil() < time()) { 13 return $this->newDialog() 14 ->setTitle(pht('Normal Security Restored')) 15 ->appendParagraph( 16 pht('Your session is no longer in high security.')) 17 ->addCancelButton($panel_uri, pht('Continue')); 18 } 19 20 if ($request->isFormPost()) { 21 22 id(new PhabricatorAuthSessionEngine()) 23 ->exitHighSecurity($viewer, $session); 24 25 return id(new AphrontRedirectResponse()) 26 ->setURI($this->getApplicationURI('session/downgrade/')); 27 } 28 29 return $this->newDialog() 30 ->setTitle(pht('Leaving High Security')) 31 ->appendParagraph( 32 pht( 33 'Leave high security and return your session to normal '. 34 'security levels?')) 35 ->appendParagraph( 36 pht( 37 'If you leave high security, you will need to authenticate '. 38 'again the next time you try to take a high security action.')) 39 ->appendParagraph( 40 pht( 41 'On the plus side, that purple notification bubble will '. 42 'disappear.')) 43 ->addSubmitButton(pht('Leave High Security')) 44 ->addCancelButton($panel_uri, pht('Stay')); 45 } 46 47 48}