Differential D20024 Diff 47821 src/applications/auth/controller/contact/PhabricatorAuthContactNumberPrimaryController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/contact/PhabricatorAuthContactNumberPrimaryController.php
Show All 35 Lines | if ($number->getIsPrimary()) { | ||||
return $this->newDialog() | return $this->newDialog() | ||||
->setTitle(pht('Number Already Primary')) | ->setTitle(pht('Number Already Primary')) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'This contact number is already your primary contact number.')) | 'This contact number is already your primary contact number.')) | ||||
->addCancelButton($cancel_uri); | ->addCancelButton($cancel_uri); | ||||
} | } | ||||
if ($request->isFormPost()) { | if ($request->isFormOrHisecPost()) { | ||||
$xactions = array(); | $xactions = array(); | ||||
$xactions[] = id(new PhabricatorAuthContactNumberTransaction()) | $xactions[] = id(new PhabricatorAuthContactNumberTransaction()) | ||||
->setTransactionType( | ->setTransactionType( | ||||
PhabricatorAuthContactNumberPrimaryTransaction::TRANSACTIONTYPE) | PhabricatorAuthContactNumberPrimaryTransaction::TRANSACTIONTYPE) | ||||
->setNewValue(true); | ->setNewValue(true); | ||||
$editor = id(new PhabricatorAuthContactNumberEditor()) | $editor = id(new PhabricatorAuthContactNumberEditor()) | ||||
->setActor($viewer) | ->setActor($viewer) | ||||
->setContentSourceFromRequest($request) | ->setContentSourceFromRequest($request) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->setContinueOnMissingFields(true); | ->setContinueOnMissingFields(true) | ||||
->setCancelURI($cancel_uri); | |||||
try { | try { | ||||
$editor->applyTransactions($number, $xactions); | $editor->applyTransactions($number, $xactions); | ||||
} catch (PhabricatorApplicationTransactionValidationException $ex) { | } catch (PhabricatorApplicationTransactionValidationException $ex) { | ||||
// This happens when you try to make a number into your primary | // This happens when you try to make a number into your primary | ||||
// number, but you have contact number MFA on your account. | // number, but you have contact number MFA on your account. | ||||
return $this->newDialog() | return $this->newDialog() | ||||
->setTitle(pht('Unable to Make Primary')) | ->setTitle(pht('Unable to Make Primary')) | ||||
Show All 23 Lines |