diff --git a/README.md b/README.md index 521ae7b..9a661a5 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ ## 운영 메모 -메인 버튼은 기존 4개를 유지합니다. Rhymix 사이트 관리자 로그인 상태에서는 미니앱 실행 시 공통 암호를 묻지 않습니다. 이때 `/custom/launcher/api.php?adminSession=1` 또는 `session=1` 응답에서 공통 접근 쿠키를 함께 발급해, 이동한 미니앱 내부 세션 검사에서도 바로 통과합니다. +메인 버튼은 기존 4개를 유지합니다. Rhymix 사이트 관리자 로그인 상태에서는 미니앱 실행 시 공통 암호를 묻지 않습니다. 이때 `/custom/launcher/api.php?adminSession=1` 또는 `session=1` 응답에서 관리자 공통 접근 쿠키를 함께 발급해, 이동한 미니앱 내부 세션 검사에서도 바로 통과합니다. + +공통 암호로 로그인한 일반 인증 쿠키는 30분만 유지합니다. 사이트 관리자 세션이 확인되어 발급된 관리자 인증 쿠키는 반영구 운영값으로 10년 유지합니다. `/custom/launcher/api.php?session=1`은 현재 브라우저가 가진 공통 쿠키 또는 사이트 관리자 세션을 확인하고, `/custom/launcher/api.php?adminSession=1`은 관리 버튼 노출처럼 실제 Rhymix 관리자 세션이 필요한 화면에서만 사용합니다. 암호는 숫자 4자리만 허용합니다. 로그인과 암호 변경 입력창은 `inputmode=numeric`, `[0-9]*` 패턴, 커스텀 숫자 키패드를 사용하며 Android/iPhone에서 문자 키보드가 뜨지 않도록 `readonly` 입력창에 화면 키패드로 값을 넣습니다. 서버 API도 4자리 숫자가 아닌 암호를 거부합니다. diff --git a/api.php b/api.php index 7dedb9a..3fd9230 100644 --- a/api.php +++ b/api.php @@ -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()]); }