3 final class PhabricatorAuthManagementVerifyWorkflow
4 extends PhabricatorAuthManagementWorkflow
{
6 protected function didConstruct() {
9 ->setExamples('**verify** __email__')
12 'Verify an unverified email address which is already attached to '.
13 'an account. This will also re-execute event hooks for addresses '.
14 'which are already verified.'))
24 public function execute(PhutilArgumentParser
$args) {
25 $emails = $args->getArg('email');
27 throw new PhutilArgumentUsageException(
28 pht('You must specify the email to verify.'));
29 } else if (count($emails) > 1) {
30 throw new PhutilArgumentUsageException(
31 pht('You can only verify one address at a time.'));
33 $address = head($emails);
35 $email = id(new PhabricatorUserEmail())->loadOneWhere(
39 throw new PhutilArgumentUsageException(
41 'No email exists with address "%s"!',
45 $viewer = $this->getViewer();
47 $user = id(new PhabricatorPeopleQuery())
49 ->withPHIDs(array($email->getUserPHID()))
52 throw new Exception(pht('Email record has invalid user PHID!'));
55 $editor = id(new PhabricatorUserEditor())
57 ->verifyEmail($user, $email);
59 $console = PhutilConsole
::getConsole();