Merge init() and content()

This commit is contained in:
nupplaPhil 2019-12-28 15:21:58 +01:00
parent aa5771cf3e
commit 97924d39d9
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90

View file

@ -18,20 +18,18 @@ use Psr\Log\LoggerInterface;
*/ */
class OpenID extends BaseModule class OpenID extends BaseModule
{ {
public static function init(array $parameters = []) public static function content(array $parameters = [])
{ {
/** @var Configuration $config */ /** @var Configuration $config */
$config = self::getClass(Configuration::class); $config = self::getClass(Configuration::class);
/** @var BaseURL $baseUrl */ /** @var BaseURL $baseUrl */
$baseUrl = self::getClass(BaseURL::class); $baseUrl = self::getClass(BaseURL::class);
if ($config->get('system', 'no_openid')) { if ($config->get('system', 'no_openid')) {
$baseUrl->redirect(); $baseUrl->redirect();
} }
}
public static function content(array $parameters = [])
{
/** @var LoggerInterface $logger */ /** @var LoggerInterface $logger */
$logger = self::getClass(LoggerInterface::class); $logger = self::getClass(LoggerInterface::class);
@ -42,9 +40,6 @@ class OpenID extends BaseModule
if (!empty($_GET['openid_mode']) && !empty($session->get('openid'))) { if (!empty($_GET['openid_mode']) && !empty($session->get('openid'))) {
/** @var BaseURL $baseUrl */
$baseUrl = self::getClass(BaseURL::class);
$openid = new LightOpenID($baseUrl->getHostname()); $openid = new LightOpenID($baseUrl->getHostname());
/** @var L10n $l10n */ /** @var L10n $l10n */
@ -93,8 +88,6 @@ class OpenID extends BaseModule
$open_id_obj->identity = $authId; $open_id_obj->identity = $authId;
$session->set('openid_server', $open_id_obj->discover($open_id_obj->identity)); $session->set('openid_server', $open_id_obj->discover($open_id_obj->identity));
$config = self::getClass(Configuration::class);
if (intval($config->get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED) { if (intval($config->get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED) {
notice($l10n->t('Account not found. Please login to your existing account to add the OpenID to it.')); notice($l10n->t('Account not found. Please login to your existing account to add the OpenID to it.'));
} else { } else {