summaryrefslogtreecommitdiff
path: root/pages/api/reauthenticate.php
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-05-12 16:43:04 +0200
committerRaindropsSys <contact@minteck.org>2023-05-12 16:43:04 +0200
commit0e4f6cea6a4f8d1f860ded405a66f9fca9d93d96 (patch)
treef8dcad460d9120442e23c8c567ba246eed39f71a /pages/api/reauthenticate.php
parent761c84c0c17c04113608a20e8401270023741c7e (diff)
downloadpluralconnect-0e4f6cea6a4f8d1f860ded405a66f9fca9d93d96.tar.gz
pluralconnect-0e4f6cea6a4f8d1f860ded405a66f9fca9d93d96.tar.bz2
pluralconnect-0e4f6cea6a4f8d1f860ded405a66f9fca9d93d96.zip
Updated 5 files and added 29 files (automated)
Diffstat (limited to 'pages/api/reauthenticate.php')
-rw-r--r--pages/api/reauthenticate.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/pages/api/reauthenticate.php b/pages/api/reauthenticate.php
new file mode 100644
index 0000000..50657cc
--- /dev/null
+++ b/pages/api/reauthenticate.php
@@ -0,0 +1,19 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
+
+header("Content-Type: text/plain");
+
+if (!$isLoggedIn || $isLowerLoggedIn) {
+ header("Location: /-/login");
+ die();
+}
+
+$newToken = generateToken();
+
+if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $newToken, file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['PEH2_SESSION_TOKEN']));
+}
+
+die($newToken); \ No newline at end of file