Debian Codegraph @

django/views/templates/csrf_403.html

raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 <meta name="robots" content="NONE,NOARCHIVE">
6 <title>403 Forbidden</title>
7 <style>
8 html * { padding:0; margin:0; }
9 body * { padding:10px 20px; }
10 body * * { padding:0; }
11 body { font-family: sans-serif; background:#eee; color:#000; }
12 body>div { border-bottom:1px solid #ddd; }
13 h1 { font-weight:normal; margin-bottom:.4em; }
14 h1 span { font-size:60%; color:#666; font-weight:normal; }
15 #info { background:#f6f6f6; }
16 #info ul { margin: 0.5em 4em; }
17 #info p, #summary p { padding-top:10px; }
18 #summary { background: #ffc; }
19 #explanation { background:#eee; border-bottom: 0px none; }
20 </style>
21 </head>
22 <body>
23 <div id="summary">
24 <h1>{{ title }} <span>(403)</span></h1>
25 <p>{{ main }}</p>
26 {% if no_referer %}
27 <p>{{ no_referer1 }}</p>
28 <p>{{ no_referer2 }}</p>
29 <p>{{ no_referer3 }}</p>
30 {% endif %}
31 {% if no_cookie %}
32 <p>{{ no_cookie1 }}</p>
33 <p>{{ no_cookie2 }}</p>
34 {% endif %}
35 </div>
36 {% if DEBUG %}
37 <div id="info">
38 <h2>Help</h2>
39 {% if reason %}
40 <p>Reason given for failure:</p>
41 <pre>
42 {{ reason }}
43 </pre>
44 {% endif %}
45
46 <p>In general, this can occur when there is a genuine Cross Site Request Forgery, or when
47 <a
48 href="https://docs.djangoproject.com/en/{{ docs_version }}/ref/csrf/">Django’s
49 CSRF mechanism</a> has not been used correctly. For POST forms, you need to
50 ensure:</p>
51
52 <ul>
53 <li>Your browser is accepting cookies.</li>
54
55 <li>The view function passes a <code>request</code> to the template’s <a
56 href="https://docs.djangoproject.com/en/{{ docs_version }}/topics/templates/#django.template.backends.base.Template.render"><code>render</code></a>
57 method.</li>
58
59 <li>In the template, there is a <code>{% templatetag openblock %} csrf_token
60 {% templatetag closeblock %}</code> template tag inside each POST form that
61 targets an internal URL.</li>
62
63 <li>If you are not using <code>CsrfViewMiddleware</code>, then you must use
64 <code>csrf_protect</code> on any views that use the <code>csrf_token</code>
65 template tag, as well as those that accept the POST data.</li>
66
67 <li>The form has a valid CSRF token. After logging in in another browser
68 tab or hitting the back button after a login, you may need to reload the
69 page with the form, because the token is rotated after a login.</li>
70 </ul>
71
72 <p>You’re seeing the help section of this page because you have <code>DEBUG =
73 True</code> in your Django settings file. Change that to <code>False</code>,
74 and only the initial error message will be displayed. </p>
75
76 <p>You can customize this page using the CSRF_FAILURE_VIEW setting.</p>
77 </div>
78 {% else %}
79 <div id="explanation">
80 <p><small>{{ more }}</small></p>
81 </div>
82 {% endif %}
83 </body>
84 </html>