- // Otherwise it's probably an openid.
- try {
- require_once 'library/openid.php';
- $openid = new \LightOpenID;
- $openid->identity = $openid_url;
- $_SESSION['openid'] = $openid_url;
- $_SESSION['remember'] = $_POST['remember'];
- $openid->returnUrl = self::getApp()->get_baseurl(true) . '/openid';
- goaway($openid->authUrl());
- } catch (Exception $e) {
- notice(L10n::t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . '<br /><br >' . L10n::t('The error message was:') . ' ' . $e->getMessage());
- }
+ /**
+ * Attempts to authenticate using OpenId
+ *
+ * @param string $openid_url OpenID URL string
+ * @param bool $remember Whether to set the session remember flag
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ private static function openIdAuthentication($openid_url, $remember)
+ {
+ $noid = Config::get('system', 'no_openid');
+
+ $a = self::getApp();
+
+ // if it's an email address or doesn't resolve to a URL, fail.
+ if ($noid || strpos($openid_url, '@') || !Network::isUrlValid($openid_url)) {
+ notice(L10n::t('Login failed.') . EOL);
+ $a->internalRedirect();