사용자 도구

사이트 도구


python:django:csrf

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
python:django:csrf [2025/08/14 12:46] taekgupython:django:csrf [2025/08/14 12:53] (현재) taekgu
줄 8: 줄 8:
          <button type="submit">Submit</button>          <button type="submit">Submit</button>
      </form>      </form>
 +</code>
 +
 +<code>
 +function getCookie(name) {
 +    let cookieValue = null;
 +    if (document.cookie && document.cookie !== '') {
 +        const cookies = document.cookie.split(';');
 +        for (let i = 0; i < cookies.length; i++) {
 +            const cookie = cookies[i].trim();
 +            // Does this cookie string begin with the name we want?
 +            if (cookie.substring(0, name.length + 1) === (name + '=')) {
 +                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
 +                break;
 +            }
 +        }
 +    }
 +    return cookieValue;
 +}
 +const csrftoken = getCookie('csrftoken');
 </code> </code>
python/django/csrf.txt · 마지막으로 수정됨: 2025/08/14 12:53 저자 taekgu