- CSRF 토큰 저장소 쿠키 → 세션 전환 및 클라이언트 로직 수정
- error 페이지 텍스트 동적 처리 추가 (prod 환경 구분) - CSRF 메타 데이터 추가 및 JS/AJAX CSRF 로직 일원화
This commit is contained in:
@@ -14,8 +14,9 @@
|
||||
const counterEl = document.getElementById('djbCommentCharCounter');
|
||||
|
||||
function getCsrfToken() {
|
||||
const match = document.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/);
|
||||
return match ? decodeURIComponent(match[1]) : '';
|
||||
// 세션 기반 CSRF: 쿠키 대신 <meta name="_csrf">에서 토큰을 읽는다.
|
||||
const meta = document.querySelector('meta[name="_csrf"]');
|
||||
return meta ? meta.getAttribute('content') : '';
|
||||
}
|
||||
|
||||
function fetchJson(url, options) {
|
||||
|
||||
Reference in New Issue
Block a user