aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin/login/index.php9
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();