]> git.mxchange.org Git - friendica.git/commitdiff
Simplify the code
authorMichael <heluecht@pirati.ca>
Thu, 10 Jun 2021 07:02:06 +0000 (07:02 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 10 Jun 2021 07:02:06 +0000 (07:02 +0000)
src/Module/OAuth/Authorize.php

index 105ea2c36b14ab6c335f2356996ee5749de2021b..b2792c598f70dc2300aeec1f6a2db60ca8d16cfe 100644 (file)
@@ -23,7 +23,6 @@ namespace Friendica\Module\OAuth;
 
 use Friendica\Core\Logger;
 use Friendica\DI;
-use Friendica\Model\Post\Content;
 use Friendica\Module\BaseApi;
 use Friendica\Security\OAuth;
 
@@ -33,6 +32,8 @@ use Friendica\Security\OAuth;
  */
 class Authorize extends BaseApi
 {
+       private static $oauth_code = '';
+
        /**
         * @param array $parameters
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
@@ -93,18 +94,15 @@ class Authorize extends BaseApi
                        DI::app()->redirect($application['redirect_uri'] . (strpos($application['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']]));
                }
 
-               DI::session()->set('oauth_token_code', $token['code']);
+               self::$oauth_code = $token['code'];
        }
 
        public static function content(array $parameters = [])
        {
-               $code = DI::session()->get('oauth_token_code');
-               DI::session()->remove('oauth_token_code');
-
-               if (empty($code)) {
+               if (empty(self::$oauth_code)) {
                        return '';
                }
 
-               return DI::l10n()->t('Please copy the following authentication code into your application and close this window: %s', $code);
+               return DI::l10n()->t('Please copy the following authentication code into your application and close this window: %s', self::$oauth_code);
        }
 }