Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/factor/PhabricatorAuthFactor.php
<?php | <?php | ||||
abstract class PhabricatorAuthFactor extends Phobject { | abstract class PhabricatorAuthFactor extends Phobject { | ||||
abstract public function getFactorName(); | abstract public function getFactorName(); | ||||
abstract public function getFactorShortName(); | |||||
abstract public function getFactorKey(); | abstract public function getFactorKey(); | ||||
abstract public function getFactorCreateHelp(); | abstract public function getFactorCreateHelp(); | ||||
abstract public function getFactorDescription(); | abstract public function getFactorDescription(); | ||||
abstract public function processAddFactorForm( | abstract public function processAddFactorForm( | ||||
PhabricatorAuthFactorProvider $provider, | PhabricatorAuthFactorProvider $provider, | ||||
AphrontFormView $form, | AphrontFormView $form, | ||||
AphrontRequest $request, | AphrontRequest $request, | ||||
PhabricatorUser $user); | PhabricatorUser $user); | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | abstract class PhabricatorAuthFactor extends Phobject { | ||||
} | } | ||||
public function getConfigurationCreateDescription( | public function getConfigurationCreateDescription( | ||||
PhabricatorAuthFactorProvider $provider, | PhabricatorAuthFactorProvider $provider, | ||||
PhabricatorUser $user) { | PhabricatorUser $user) { | ||||
return null; | return null; | ||||
} | } | ||||
public function getConfigurationListDetails( | |||||
PhabricatorAuthFactorConfig $config, | |||||
PhabricatorAuthFactorProvider $provider, | |||||
PhabricatorUser $viewer) { | |||||
return null; | |||||
} | |||||
/** | /** | ||||
* Is this a factor which depends on the user's contact number? | * Is this a factor which depends on the user's contact number? | ||||
* | * | ||||
* If a user has a "contact number" factor configured, they can not modify | * If a user has a "contact number" factor configured, they can not modify | ||||
* or switch their primary contact number. | * or switch their primary contact number. | ||||
* | * | ||||
* @return bool True if this factor should lock contact numbers. | * @return bool True if this factor should lock contact numbers. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 442 Lines • ▼ Show 20 Lines | final protected function hasCSRF(PhabricatorAuthFactorConfig $config) { | ||||
if (!$request->isHTTPPost()) { | if (!$request->isHTTPPost()) { | ||||
return false; | return false; | ||||
} | } | ||||
return $request->validateCSRF(); | return $request->validateCSRF(); | ||||
} | } | ||||
final protected function loadConfigurationsForProvider( | |||||
PhabricatorAuthFactorProvider $provider, | |||||
PhabricatorUser $user) { | |||||
return id(new PhabricatorAuthFactorConfigQuery()) | |||||
->setViewer($user) | |||||
->withUserPHIDs(array($user->getPHID())) | |||||
->withFactorProviderPHIDs(array($provider->getPHID())) | |||||
->execute(); | |||||
} | |||||
} | } |