Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/provider/PhabricatorAuthProvider.php
Show First 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | protected function loadOrCreateAccount($account_id) { | ||||
} | } | ||||
$account = id(new PhabricatorExternalAccount())->loadOneWhere( | $account = id(new PhabricatorExternalAccount())->loadOneWhere( | ||||
'accountType = %s AND accountDomain = %s AND accountID = %s', | 'accountType = %s AND accountDomain = %s AND accountID = %s', | ||||
$adapter->getAdapterType(), | $adapter->getAdapterType(), | ||||
$adapter->getAdapterDomain(), | $adapter->getAdapterDomain(), | ||||
$account_id); | $account_id); | ||||
if (!$account) { | if (!$account) { | ||||
$account = id(new PhabricatorExternalAccount()) | $account = $this->newExternalAccount() | ||||
->setAccountType($adapter->getAdapterType()) | |||||
->setAccountDomain($adapter->getAdapterDomain()) | |||||
->setAccountID($account_id); | ->setAccountID($account_id); | ||||
} | } | ||||
$account->setUsername($adapter->getAccountName()); | $account->setUsername($adapter->getAccountName()); | ||||
$account->setRealName($adapter->getAccountRealName()); | $account->setRealName($adapter->getAccountRealName()); | ||||
$account->setEmail($adapter->getAccountEmail()); | $account->setEmail($adapter->getAccountEmail()); | ||||
$account->setAccountURI($adapter->getAccountURI()); | $account->setAccountURI($adapter->getAccountURI()); | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | abstract class PhabricatorAuthProvider extends Phobject { | ||||
public function isDefaultRegistrationProvider() { | public function isDefaultRegistrationProvider() { | ||||
return false; | return false; | ||||
} | } | ||||
public function shouldRequireRegistrationPassword() { | public function shouldRequireRegistrationPassword() { | ||||
return false; | return false; | ||||
} | } | ||||
public function getDefaultExternalAccount() { | public function newDefaultExternalAccount() { | ||||
throw new PhutilMethodNotImplementedException(); | return $this->newExternalAccount(); | ||||
} | |||||
protected function newExternalAccount() { | |||||
$config = $this->getProviderConfig(); | |||||
$adapter = $this->getAdapter(); | |||||
return id(new PhabricatorExternalAccount()) | |||||
->setAccountType($adapter->getAdapterType()) | |||||
->setAccountDomain($adapter->getAdapterDomain()) | |||||
->setProviderConfigPHID($config->getPHID()); | |||||
} | } | ||||
public function getLoginOrder() { | public function getLoginOrder() { | ||||
return '500-'.$this->getProviderName(); | return '500-'.$this->getProviderName(); | ||||
} | } | ||||
protected function getLoginIcon() { | protected function getLoginIcon() { | ||||
return 'Generic'; | return 'Generic'; | ||||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |