aboutsummaryrefslogtreecommitdiff
path: root/admin/callback/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/callback/index.php')
-rw-r--r--admin/callback/index.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/admin/callback/index.php b/admin/callback/index.php
index 8816c32..5052369 100644
--- a/admin/callback/index.php
+++ b/admin/callback/index.php
@@ -36,7 +36,14 @@ if (isset($result["access_token"])) {
$result = curl_exec($crl);
$result = json_decode($result, true);
- if ($result["id"] === "74bca7d2-4694-477c-8bc1-9003315abbee") {
+ $login = false;
+ foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/permissions.json"), true) as $id => $user) {
+ if ($result["id"] === $id && in_array("login", $user)) {
+ $login = true;
+ }
+ }
+
+ if ($login) {
$token = bin2hex(random_bytes(32));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/tokens/" . $token, json_encode($result));
setcookie("ADMIN_TOKEN", $token, 0, "/", ".minteck.ro.lt", true, true);