3 final class PhabricatorAuthFactorProviderDuoHostnameTransaction
4 extends PhabricatorAuthFactorProviderTransactionType
{
6 const TRANSACTIONTYPE
= 'duo.hostname';
8 public function generateOldValue($object) {
9 $key = PhabricatorDuoAuthFactor
::PROP_HOSTNAME
;
10 return $object->getAuthFactorProviderProperty($key);
13 public function applyInternalEffects($object, $value) {
14 $key = PhabricatorDuoAuthFactor
::PROP_HOSTNAME
;
15 $object->setAuthFactorProviderProperty($key, $value);
18 public function getTitle() {
20 '%s changed the hostname for this provider from %s to %s.',
21 $this->renderAuthor(),
22 $this->renderOldValue(),
23 $this->renderNewValue());
26 public function validateTransactions($object, array $xactions) {
29 if (!$this->isDuoProvider($object)) {
33 $old_value = $this->generateOldValue($object);
34 if ($this->isEmptyTextTransaction($old_value, $xactions)) {
35 $errors[] = $this->newRequiredError(
36 pht('Duo providers must have an API hostname.'));
39 foreach ($xactions as $xaction) {
40 $new_value = $xaction->getNewValue();
42 if (!strlen($new_value)) {
46 if ($new_value === $old_value) {
51 PhabricatorDuoAuthFactor
::requireDuoAPIHostname($new_value);
52 } catch (Exception
$ex) {
53 $errors[] = $this->newInvalidError(