diff options
author | zotlabs <mike@macgirvin.com> | 2018-04-03 21:08:40 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-04-03 21:08:40 -0700 |
commit | 4915a4efbb5a25668a917a953b8d8c49a3181e1c (patch) | |
tree | c78dc0df6e224f5f4030267061704de5c140bfef /Zotlabs/Module/Authorize.php | |
parent | 245142cc07bd989adfb03bb7680e3db948e7564f (diff) | |
download | volse-hubzilla-4915a4efbb5a25668a917a953b8d8c49a3181e1c.tar.gz volse-hubzilla-4915a4efbb5a25668a917a953b8d8c49a3181e1c.tar.bz2 volse-hubzilla-4915a4efbb5a25668a917a953b8d8c49a3181e1c.zip |
OAuth2 integration
Diffstat (limited to 'Zotlabs/Module/Authorize.php')
-rw-r--r-- | Zotlabs/Module/Authorize.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Zotlabs/Module/Authorize.php b/Zotlabs/Module/Authorize.php index c76dfb9df..bfb76150f 100644 --- a/Zotlabs/Module/Authorize.php +++ b/Zotlabs/Module/Authorize.php @@ -14,13 +14,13 @@ class Authorize extends \Zotlabs\Web\Controller { // OpenID Connect Dynamic Client Registration 1.0 Client Metadata // http://openid.net/specs/openid-connect-registration-1_0.html $app = array( - 'name' => (x($_REQUEST, 'client_name') ? urldecode($_REQUEST['client_name']) : 'Unknown App'), - 'icon' => (x($_REQUEST, 'logo_uri') ? urldecode($_REQUEST['logo_uri']) : z_root() . '/images/icons/plugin.png'), - 'url' => (x($_REQUEST, 'client_uri') ? urldecode($_REQUEST['client_uri']) : ''), + 'name' => (x($_REQUEST, 'client_name') ? urldecode($_REQUEST['client_name']) : t('Unknown App')), + 'icon' => (x($_REQUEST, 'logo_uri') ? urldecode($_REQUEST['logo_uri']) : z_root() . '/images/icons/plugin.png'), + 'url' => (x($_REQUEST, 'client_uri') ? urldecode($_REQUEST['client_uri']) : ''), ); $o .= replace_macros(get_markup_template('oauth_authorize.tpl'), array( - '$title' => '', - '$authorize' => 'Do you authorize the app <a style="float: none;" href="' . $app['url'] . '">' . $app['name'] . '</a> to access your channel data?', + '$title' => t('Authorize'), + '$authorize' => sprintf( t('Do you authorize the app %s to access your channel data?'), '<a style="float: none;" href="' . $app['url'] . '">' . $app['name'] . '</a> '), '$app' => $app, '$yes' => t('Allow'), '$no' => t('Deny'), @@ -33,8 +33,8 @@ class Authorize extends \Zotlabs\Web\Controller { } function post() { - if (!local_channel()) { - return $this->get(); + if (! local_channel()) { + return; } $storage = new OAuth2Storage(\DBA::$dba->db); @@ -85,10 +85,8 @@ class Authorize extends \Zotlabs\Web\Controller { $is_authorized = ($_POST['authorize'] === 'allow'); $s->handleAuthorizeRequest($request, $response, $is_authorized, local_channel()); if ($is_authorized) { - // this is only here so that you get to see your code in the cURL request. Otherwise, - // we'd redirect back to the client $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40); - echo("SUCCESS! Authorization Code: $code"); + logger('Authorization Code: ' . $code); } $response->send(); |