/**
  * Is this a live account which has passed required approvals? Returns true
  * if this is an enabled, verified (if required), approved (if required)
  * account, and false otherwise.
  *
  * @return bool True if this is a standard, usable account.
  */
 public function isUserActivated()
 {
     if ($this->getIsDisabled()) {
         return false;
     }
     if (!$this->getIsApproved()) {
         return false;
     }
     if (PhabricatorUserEmail::isEmailVerificationRequired()) {
         if (!$this->getIsEmailVerified()) {
             return false;
         }
     }
     return true;
 }
 public function validateSender(PhabricatorMetaMTAReceivedMail $mail, PhabricatorUser $sender)
 {
     $failure_reason = null;
     if ($sender->getIsDisabled()) {
         $failure_reason = pht('Your account (%s) is disabled, so you can not interact with ' . 'Phabricator over email.', $sender->getUsername());
     } else {
         if ($sender->getIsStandardUser()) {
             if (!$sender->getIsApproved()) {
                 $failure_reason = pht('Your account (%s) has not been approved yet. You can not interact ' . 'with Phabricator over email until your account is approved.', $sender->getUsername());
             } else {
                 if (PhabricatorUserEmail::isEmailVerificationRequired() && !$sender->getIsEmailVerified()) {
                     $failure_reason = pht('You have not verified the email address for your account (%s). ' . 'You must verify your email address before you can interact ' . 'with Phabricator over email.', $sender->getUsername());
                 }
             }
         }
     }
     if ($failure_reason) {
         throw new PhabricatorMetaMTAReceivedMailProcessingException(MetaMTAReceivedMailStatus::STATUS_DISABLED_SENDER, $failure_reason);
     }
 }
 private function validateAuthenticatedUser(ConduitAPIRequest $request, PhabricatorUser $user)
 {
     if ($user->getIsDisabled()) {
         return array('ERR-USER-DISABLED', 'User is disabled.');
     }
     if (PhabricatorUserEmail::isEmailVerificationRequired()) {
         $email = $user->loadPrimaryEmail();
         if (!$email) {
             return array('ERR-USER-NOEMAIL', 'User has no primary email address.');
         }
         if (!$email->getIsVerified()) {
             return array('ERR-USER-UNVERIFIED', 'User has unverified email address.');
         }
     }
     $request->setUser($user);
     return null;
 }
 public function shouldRequireEmailVerification()
 {
     return PhabricatorUserEmail::isEmailVerificationRequired();
 }
 public function shouldRequireEmailVerification()
 {
     $need_verify = PhabricatorUserEmail::isEmailVerificationRequired();
     $need_login = $this->shouldRequireLogin();
     return $need_login && $need_verify;
 }