#31101: {% csrf_token %} fails validation for xhtml
-------------------------------------+-------------------------------------
               Reporter:  Ruben      |          Owner:  nobody
  Garcia                             |
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:  CSRF       |        Version:  3.0
               Severity:  Normal     |       Keywords:  xhtml, csrf
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 {% csrf_token %} produces
 <input type="hidden" name="csrfmiddlewaretoken" value="TOKEN">
 which does not work with xhtml.
 https://docs.djangoproject.com/en/3.0/ref/csrf/
 does not mention any option to make it output the correct value
 <input type="hidden" name="csrfmiddlewaretoken" value="TOKEN"/>

 Of course, templates could use
 <input type="hidden" name="{{CSRF_COOKIE_NAME}}" value={{csrf_token}}/>
 themselves, but this should be easy to implement.

 If there is a general django option which all middleware uses to
 distinguish html from xhtml, I have not found it; I would request that it
 be mentioned at
 https://docs.djangoproject.com/en/3.0/ref/csrf/

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31101>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.acac63f1732f05fb404a0d491d2857fa%40djangoproject.com.

Reply via email to