]> git.mxchange.org Git - friendica.git/blobdiff - mod/openid.php
Merge pull request #6077 from nupplaphil/move_random_digits
[friendica.git] / mod / openid.php
index 63b29684b3c5eded4a1fa651470a76ee192dc8b5..d1404ba804f4afec2f65de81db24d96a7ec9ff4e 100644 (file)
@@ -4,8 +4,10 @@
  */
 
 use Friendica\App;
+use Friendica\Core\Authentication;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
+use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 
@@ -13,9 +15,9 @@ function openid_content(App $a) {
 
        $noid = Config::get('system','no_openid');
        if($noid)
-               goaway(System::baseUrl());
+               $a->internalRedirect();
 
-       logger('mod_openid ' . print_r($_REQUEST,true), LOGGER_DATA);
+       Logger::log('mod_openid ' . print_r($_REQUEST,true), Logger::DATA);
 
        if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
 
@@ -26,8 +28,8 @@ function openid_content(App $a) {
                        $authid = $_REQUEST['openid_identity'];
 
                        if(! strlen($authid)) {
-                               logger(L10n::t('OpenID protocol error. No ID returned.') . EOL);
-                               goaway(System::baseUrl());
+                               Logger::log(L10n::t('OpenID protocol error. No ID returned.') . EOL);
+                               $a->internalRedirect();
                        }
 
                        // NOTE: we search both for normalised and non-normalised form of $authid
@@ -50,13 +52,12 @@ function openid_content(App $a) {
 
                                unset($_SESSION['openid']);
 
-                               require_once('include/security.php');
-                               authenticate_success($r[0],true,true);
+                               Authentication::setAuthenticatedSessionForUser($r[0],true,true);
 
                                // just in case there was no return url set
                                // and we fell through
 
-                               goaway(System::baseUrl());
+                               $a->internalRedirect();
                        }
 
                        // Successful OpenID login - but we can't match it to an existing account.
@@ -64,7 +65,7 @@ function openid_content(App $a) {
 
                        if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
                                notice(L10n::t('Account not found and OpenID registration is not permitted on this site.') . EOL);
-                               goaway(System::baseUrl());
+                               $a->internalRedirect();
                        }
 
                        unset($_SESSION['register']);
@@ -108,12 +109,12 @@ function openid_content(App $a) {
 
                        $args .= '&openid_url=' . urlencode(notags(trim($authid)));
 
-                       goaway(System::baseUrl() . '/register?' . $args);
+                       $a->internalRedirect('register?' . $args);
 
                        // NOTREACHED
                }
        }
        notice(L10n::t('Login failed.') . EOL);
-       goaway(System::baseUrl());
+       $a->internalRedirect();
        // NOTREACHED
 }