Issue access cookie for admin sessions
This commit is contained in:
@@ -63,11 +63,24 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (isset($_GET['session'])) {
|
||||
custom_json(['authenticated' => custom_has_auth_cookie()]);
|
||||
if (custom_has_auth_cookie()) {
|
||||
custom_json(['authenticated' => true, 'admin' => false]);
|
||||
}
|
||||
|
||||
if (custom_is_site_admin()) {
|
||||
custom_issue_auth_cookie();
|
||||
custom_json(['authenticated' => true, 'admin' => true]);
|
||||
}
|
||||
|
||||
custom_json(['authenticated' => false, 'admin' => false]);
|
||||
}
|
||||
|
||||
if (isset($_GET['adminSession'])) {
|
||||
custom_json(['admin' => custom_is_site_admin()]);
|
||||
$isAdmin = custom_is_site_admin();
|
||||
if ($isAdmin) {
|
||||
custom_issue_auth_cookie();
|
||||
}
|
||||
custom_json(['admin' => $isAdmin, 'authenticated' => $isAdmin || custom_has_auth_cookie()]);
|
||||
}
|
||||
|
||||
if (isset($_GET['failMessages'])) {
|
||||
|
||||
Reference in New Issue
Block a user