Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F549587
PhabricatorAuthFactorProviderDuoHostnameTransaction.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
PhabricatorAuthFactorProviderDuoHostnameTransaction.php
View Options
<?php
final
class
PhabricatorAuthFactorProviderDuoHostnameTransaction
extends
PhabricatorAuthFactorProviderTransactionType
{
const
TRANSACTIONTYPE
=
'duo.hostname'
;
public
function
generateOldValue
(
$object
)
{
$key
=
PhabricatorDuoAuthFactor
::
PROP_HOSTNAME
;
return
$object
->
getAuthFactorProviderProperty
(
$key
);
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$key
=
PhabricatorDuoAuthFactor
::
PROP_HOSTNAME
;
$object
->
setAuthFactorProviderProperty
(
$key
,
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s changed the hostname for this provider from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(!
$this
->
isDuoProvider
(
$object
))
{
return
$errors
;
}
$old_value
=
$this
->
generateOldValue
(
$object
);
if
(
$this
->
isEmptyTextTransaction
(
$old_value
,
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Duo providers must have an API hostname.'
));
}
foreach
(
$xactions
as
$xaction
)
{
$new_value
=
$xaction
->
getNewValue
();
if
(!
strlen
(
$new_value
))
{
continue
;
}
if
(
$new_value
===
$old_value
)
{
continue
;
}
try
{
PhabricatorDuoAuthFactor
::
requireDuoAPIHostname
(
$new_value
);
}
catch
(
Exception
$ex
)
{
$errors
[]
=
$this
->
newInvalidError
(
$ex
->
getMessage
(),
$xaction
);
continue
;
}
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 2:13 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
121055
Default Alt Text
PhabricatorAuthFactorProviderDuoHostnameTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment