3

I'm using python 3.7.4, django 3.06, javascript and jquery on windows 7.

I'm not sure when it happens but now my console (F12 on firefox) gives me these warning:

Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/lists/list-name/” because the scheme does not match. list-name
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/common.js” because the scheme does not match. common.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/js/common.js” because the scheme does not match. common.js
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/lists/js/lists.js” because the scheme does not match. lists.js
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/lists/js/lists.js” because the scheme does not match. lists.js
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/jsi18n/” because the scheme does not match. jsi18n
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/jsi18n/” because the scheme does not match. jsi18n
Cookie “PGADMIN_KEY” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/icons/favicon.png” because the scheme does not match. favicon.png
Cookie “PGADMIN_LANGUAGE” will be soon treated as cross-site cookie against “http://127.0.0.1:8000/static/icons/favicon.png” because the scheme does not match. favicon.png

​I was testing my code, I made some change to it but nothing related to cookies or admin and my site has a very limited use for cookies. PGADMIN_KEY and PGADMIN_LANGUAGE look like django admin cookies and I haven't touched them. jsi18n is the traslation module for django: not my code, I took it like it was.

I haven't done upgrades in these days.

I don't know what code you can need to help me.

I use this in my template (I see jquery.cookie is not more updated but even js.cookie.min.js gives the same problem):

<script type='text/javascript' src=' http://cdn.jsdelivr.net/jquery.cookie/1.4.1/jquery.cookie.min.js '></script>
<script type='text/javascript' src="{% static '/js/common.js' %}"></script>
<link rel='icon' type='image/png' href="{% static 'icons/favicon.png' %}">

also this for cookies:

var csrftoken = $.cookie('csrftoken');
function csrfSafeMethod(method) {
    // these HTTP methods do not require CSRF protection
    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
    beforeSend: function(xhr, settings) {
        if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
            xhr.setRequestHeader('X-CSRFToken', csrftoken);
        };
    }
});
fabio
  • 1,210
  • 2
  • 26
  • 55
  • 1
    I also strongly suggest you load a) a newer jQuery and b) load it over HTTPS – mplungjan Jul 10 '20 at 10:14
  • @mplungjan I made the changes you suggest and I read same articles but the solution isn't clear yet. The cookies pgadmin_key and pgadmin_language come from my database postgresql and I didnt set them explicitly so it's something that should be resolved by postgres developers, right? – fabio Jul 12 '20 at 19:00

2 Answers2

4

The warnings, like said in a deleted comment, should come from the new policy about cookies. The cookies comes from pgAdmin, included in PostgreSQL.

I solved upgrading to the last version of pgAdmin AND deleting the cookies stored in the cache.

halfer
  • 19,824
  • 17
  • 99
  • 186
fabio
  • 1,210
  • 2
  • 26
  • 55
  • 1
    (Comments under questions or answers are mostly deleted in response to a user-raised flag. In some cases comments can be auto-deleted on a user-raised flag if they match several trivial criteria e.g. they are primarily thanks). – halfer Aug 28 '20 at 23:23
4

similar error, but without python nor django , was solved by clearing the cookies (firefox | developper tools | Storage | cookies...) and refreshing the page.

Atara
  • 3,523
  • 6
  • 37
  • 56