diff options
Diffstat (limited to 'pages/api')
-rw-r--r-- | pages/api/reauthenticate.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pages/api/reauthenticate.php b/pages/api/reauthenticate.php index fe10d28..2b5a8ca 100644 --- a/pages/api/reauthenticate.php +++ b/pages/api/reauthenticate.php @@ -14,7 +14,13 @@ $newToken = generateToken(); if (isset($_COOKIE['PEH2_SESSION_TOKEN']) && $isLoggedIn) { $old = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['PEH2_SESSION_TOKEN']), true); - $old["name"] = base64_decode($_GET["name"] ?? "LQo="); + + if (!isset($_GET["plain"])) { + $old["name"] = base64_decode($_GET["name"] ?? "LQo="); + } else { + $old["name"] = $_GET["name"] ?? "-"; + } + $old["created"] = time(); $old["addresses"] = []; $old["last"] = time(); @@ -23,7 +29,13 @@ if (isset($_COOKIE['PEH2_SESSION_TOKEN']) && $isLoggedIn) { file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $newToken, json_encode($old)); } else if (isset($_COOKIE['PEH2_SESSION_TOKEN']) && $isLowerLoggedIn) { $old = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $_COOKIE['PEH2_SESSION_TOKEN']), true); - $old["name"] = base64_decode($_GET["name"] ?? "LQo="); + + if (!isset($_GET["plain"])) { + $old["name"] = base64_decode($_GET["name"] ?? "LQo="); + } else { + $old["name"] = $_GET["name"] ?? "-"; + } + $old["created"] = time(); $old["addresses"] = []; $old["last"] = time(); |