Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/factor/PhabricatorAuthFactor.php
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | abstract class PhabricatorAuthFactor extends Phobject { | ||||
} | } | ||||
abstract protected function newResultFromChallengeResponse( | abstract protected function newResultFromChallengeResponse( | ||||
PhabricatorAuthFactorConfig $config, | PhabricatorAuthFactorConfig $config, | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
AphrontRequest $request, | AphrontRequest $request, | ||||
array $challenges); | array $challenges); | ||||
final protected function newAutomaticControl( | |||||
PhabricatorAuthFactorResult $result) { | |||||
$is_answered = (bool)$result->getAnsweredChallenge(); | |||||
if ($is_answered) { | |||||
return $this->newAnsweredControl($result); | |||||
} | |||||
$is_wait = $result->getIsWait(); | |||||
if ($is_wait) { | |||||
return $this->newWaitControl($result); | |||||
} | |||||
return null; | |||||
} | |||||
private function newWaitControl( | |||||
PhabricatorAuthFactorResult $result) { | |||||
$error = $result->getErrorMessage(); | |||||
return id(new AphrontFormMarkupControl()) | |||||
->setValue($error) | |||||
->setError(pht('Wait')); | |||||
} | |||||
private function newAnsweredControl( | |||||
PhabricatorAuthFactorResult $result) { | |||||
return id(new AphrontFormMarkupControl()) | |||||
->setValue(pht('Answered!')); | |||||
} | |||||
} | } |