Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F436271
PhabricatorAuthManagementVerifyWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorAuthManagementVerifyWorkflow.php
View Options
<?php
final
class
PhabricatorAuthManagementVerifyWorkflow
extends
PhabricatorAuthManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'verify'
)
->
setExamples
(
'**verify** __email__'
)
->
setSynopsis
(
pht
(
'Verify an unverified email address which is already attached to '
.
'an account. This will also re-execute event hooks for addresses '
.
'which are already verified.'
))
->
setArguments
(
array
(
array
(
'name'
=>
'email'
,
'wildcard'
=>
true
,
),
));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$emails
=
$args
->
getArg
(
'email'
);
if
(!
$emails
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'You must specify the email to verify.'
));
}
else
if
(
count
(
$emails
)
>
1
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'You can only verify one address at a time.'
));
}
$address
=
head
(
$emails
);
$email
=
id
(
new
PhabricatorUserEmail
())->
loadOneWhere
(
'address = %s'
,
$address
);
if
(!
$email
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'No email exists with address "%s"!'
,
$address
));
}
$viewer
=
$this
->
getViewer
();
$user
=
id
(
new
PhabricatorPeopleQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$email
->
getUserPHID
()))
->
executeOne
();
if
(!
$user
)
{
throw
new
Exception
(
pht
(
'Email record has invalid user PHID!'
));
}
$editor
=
id
(
new
PhabricatorUserEditor
())
->
setActor
(
$viewer
)
->
verifyEmail
(
$user
,
$email
);
$console
=
PhutilConsole
::
getConsole
();
$console
->
writeOut
(
"%s
\n
"
,
pht
(
'Done.'
));
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 10:45 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
61704
Default Alt Text
PhabricatorAuthManagementVerifyWorkflow.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment