@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 recaptime-dev/main 62 lines 1.8 kB view raw
1<?php 2 3final class PhabricatorMustVerifyEmailController 4 extends PhabricatorAuthController { 5 6 public function shouldRequireEmailVerification() { 7 // NOTE: We don't technically need this since PhabricatorController forces 8 // us here in either case, but it's more consistent with intent. 9 return false; 10 } 11 12 public function handleRequest(AphrontRequest $request) { 13 $viewer = $this->getViewer(); 14 15 $email = $viewer->loadPrimaryEmail(); 16 17 if ($viewer->getIsEmailVerified()) { 18 return id(new AphrontRedirectResponse())->setURI('/'); 19 } 20 21 $email_address = $email->getAddress(); 22 23 $sent = null; 24 if ($request->isFormPost()) { 25 $email->sendVerificationEmail($viewer); 26 $sent = new PHUIInfoView(); 27 $sent->setSeverity(PHUIInfoView::SEVERITY_NOTICE); 28 $sent->setTitle(pht('Email Sent')); 29 $sent->appendChild( 30 pht( 31 'Another verification email was sent to %s.', 32 phutil_tag('strong', array(), $email_address))); 33 } 34 35 $must_verify = pht( 36 'You must verify your email address to log in. You should have a '. 37 'new email message with verification instructions in your inbox (%s).', 38 phutil_tag('strong', array(), $email_address)); 39 40 $send_again = pht( 41 'If you did not receive an email, you can click the button below '. 42 'to try sending another one.'); 43 44 $dialog = id(new AphrontDialogView()) 45 ->setUser($viewer) 46 ->setTitle(pht('Check Your Email')) 47 ->appendParagraph($must_verify) 48 ->appendParagraph($send_again) 49 ->addSubmitButton(pht('Send Another Email')); 50 51 $view = array( 52 $sent, 53 $dialog, 54 ); 55 56 return $this->newPage() 57 ->setTitle(pht('Must Verify Email')) 58 ->appendChild($view); 59 60 } 61 62}