관리자 인증 쿠키 발급을 구분
This commit is contained in:
@@ -24,7 +24,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
|
||||
if (custom_verify_password($password)) {
|
||||
custom_issue_auth_cookie();
|
||||
custom_issue_auth_cookie(false);
|
||||
custom_json(['result' => 'ok']);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
custom_json(['result' => 'fail', 'message' => 'password_save_failed'], 500);
|
||||
}
|
||||
|
||||
custom_issue_auth_cookie();
|
||||
custom_issue_auth_cookie(false);
|
||||
custom_json(['result' => 'ok']);
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (isset($_GET['session'])) {
|
||||
if (custom_has_auth_cookie()) {
|
||||
custom_json(['authenticated' => true, 'admin' => false]);
|
||||
custom_json(['authenticated' => true, 'admin' => custom_auth_cookie_is_admin()]);
|
||||
}
|
||||
|
||||
if (custom_is_site_admin()) {
|
||||
custom_issue_auth_cookie();
|
||||
custom_issue_auth_cookie(true);
|
||||
custom_json(['authenticated' => true, 'admin' => true]);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (isset($_GET['adminSession'])) {
|
||||
$isAdmin = custom_is_site_admin();
|
||||
if ($isAdmin) {
|
||||
custom_issue_auth_cookie();
|
||||
custom_issue_auth_cookie(true);
|
||||
}
|
||||
custom_json(['admin' => $isAdmin, 'authenticated' => $isAdmin || custom_has_auth_cookie()]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user