summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-07-07 22:09:19 +0200
committerRaindropsSys <contact@minteck.org>2023-07-07 22:09:19 +0200
commita5c8dce987df2f59f4605c8a34033b120b449db5 (patch)
treeb1e3e839ba15423bfbd047bc6f323575b1de5831 /auth
parent7da33614f1a8708bebcb4f04ee99224c5d6db1d3 (diff)
downloadpluralconnect-a5c8dce987df2f59f4605c8a34033b120b449db5.tar.gz
pluralconnect-a5c8dce987df2f59f4605c8a34033b120b449db5.tar.bz2
pluralconnect-a5c8dce987df2f59f4605c8a34033b120b449db5.zip
Updated 6 files (automated)
Diffstat (limited to 'auth')
-rw-r--r--auth/callback/index.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/auth/callback/index.php b/auth/callback/index.php
index f48912c..1ff53f7 100644
--- a/auth/callback/index.php
+++ b/auth/callback/index.php
@@ -37,7 +37,7 @@ if (isset($result["access_token"])) {
"Accept: application/json"
]);
- $result = curl_exec($crl);
+ $result = $result_orig = curl_exec($crl);
$result = json_decode($result, true);
if (!in_array($result["id"], $appdata["oauth"]["allowed"]["admin"]) && !in_array($result["id"], $appdata["oauth"]["allowed"]["lower"])) {
@@ -45,27 +45,32 @@ if (isset($result["access_token"])) {
die();
}
+ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions");
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens");
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens");
$token = generateToken();
if (in_array($result["id"], $appdata["oauth"]["allowed"]["admin"])) {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token, json_encode([
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . $token, json_encode([
"created" => time(),
"last" => time(),
"profile" => $result,
"addresses" => [],
"name" => "Cold Haze Web (" . get_browser(null, true)["browser"] . " on " . str_replace("Windows dows", "Windows", str_replace("Win", "Windows ", str_replace("MacOSX", "macOS", get_browser(null, true)["platform"]))) . ")"
]));
+
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token, $result_orig);
} else {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token, json_encode([
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/session/" . $token, json_encode([
"created" => time(),
"last" => time(),
"profile" => $result,
"addresses" => [],
"name" => "Cold Haze Web (" . get_browser(null, true)["browser"] . " on " . get_browser(null, true)["platform"] . ")"
]));
+
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token, $result_orig);
}
header("Set-Cookie: PEH2_SESSION_TOKEN=" . $token . "; SameSite=None; Path=/; Secure; HttpOnly; Expires=" . date("r", time() + (86400 * 730)));