Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F546431
PhabricatorAuthContactNumberTestController.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
PhabricatorAuthContactNumberTestController.php
View Options
<?php
final
class
PhabricatorAuthContactNumberTestController
extends
PhabricatorAuthContactNumberController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$sms_auth_factor
=
new
PhabricatorSMSAuthFactor
();
if
(
$sms_auth_factor
->
isSMSMailerConfigured
())
{
$number
=
id
(
new
PhabricatorAuthContactNumberQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
}
if
(!
isset
(
$number
)
||
!
$number
)
{
return
new
Aphront404Response
();
}
$id
=
$number
->
getID
();
$cancel_uri
=
$number
->
getURI
();
// NOTE: This is a global limit shared by all users.
PhabricatorSystemActionEngine
::
willTakeAction
(
array
(
id
(
new
PhabricatorAuthApplication
())->
getPHID
()),
new
PhabricatorAuthTestSMSAction
(),
1
);
if
(
$request
->
isFormPost
())
{
$uri
=
PhabricatorEnv
::
getURI
(
'/'
);
$uri
=
new
PhutilURI
(
$uri
);
$mail
=
id
(
new
PhabricatorMetaMTAMail
())
->
setMessageType
(
PhabricatorMailSMSMessage
::
MESSAGETYPE
)
->
addTos
(
array
(
$viewer
->
getPHID
()))
->
setSensitiveContent
(
false
)
->
setBody
(
pht
(
'This is a terse test text message (from "%s").'
,
$uri
->
getDomain
()))
->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$mail
->
getURI
());
}
$number_display
=
phutil_tag
(
'strong'
,
array
(),
$number
->
getDisplayName
());
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Set Test Message'
))
->
appendParagraph
(
pht
(
'Send a test message to %s?'
,
$number_display
))
->
addSubmitButton
(
pht
(
'Send SMS'
))
->
addCancelButton
(
$cancel_uri
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:14 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
122648
Default Alt Text
PhabricatorAuthContactNumberTestController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment