diff options
author | Minteck <contact@minteck.org> | 2022-04-06 21:58:17 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-04-06 21:58:17 +0200 |
commit | ad6045f0184bc0ca2e98933a748f03e7c726e6af (patch) | |
tree | 7719bb46a6b4dd0a846f3c9c2fc8ef5500d3895a | |
parent | 5eef7367c05bd33025c23865e397290ed29e955b (diff) | |
download | cloudsdale-ad6045f0184bc0ca2e98933a748f03e7c726e6af.tar.gz cloudsdale-ad6045f0184bc0ca2e98933a748f03e7c726e6af.tar.bz2 cloudsdale-ad6045f0184bc0ca2e98933a748f03e7c726e6af.zip |
Fix OAuth2 issues
-rw-r--r-- | admin/login/index.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/admin/login/index.php b/admin/login/index.php index 41c4298..9a12ac5 100644 --- a/admin/login/index.php +++ b/admin/login/index.php @@ -1,4 +1,11 @@ <?php -header("Location: https://github.com/login/oauth/authorize?client_id=" . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/github.json"), true)["id"] . "&redirect_uri=http://$_SERVER[HTTP_HOST]/admin/callback/&allow_signups=false&scope=read:user"); +function isSecure() { + return + (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') + || $_SERVER['SERVER_PORT'] == 443; +} + + +header("Location: https://github.com/login/oauth/authorize?client_id=" . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/github.json"), true)["id"] . "&redirect_uri=http" . (isSecure() ? "s" : "") . "://$_SERVER[HTTP_HOST]/admin/callback/&allow_signups=false&scope=read:user"); die(); |