1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Used strict comparison in docs/ref/csrf.txt's JavaScript.

This commit is contained in:
Camilo Nova 2016-06-28 11:51:51 -05:00 committed by Tim Graham
parent 49b4596cb4
commit 222e1334bf

View File

@ -83,12 +83,12 @@ Acquiring the token is straightforward:
// using jQuery
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}