[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/auth/controller/ -> PhabricatorMustVerifyEmailController.php (source)

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


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1