How to make sure that csrf validation is being performed? Is there a way to check it?

28 Views Asked by At

I read about how django provides csrf verification for POST data. Following that I added csrf middleware in settings.py and csrf_token in all the html forms. Do I need anything (like a decorator) along with this? and how do i verify that csrf verification is being done.

I added csrf middleware in settings.py and csrf_token in all the html forms and if I remove it, it gives csrf error and sometimes leaving the same page open for a while gives the same request error.

<form role="form" class="login-form" action="." method="POST">
    {% csrf_token %}
    <span style='color: RED; font-weight: bold;'>{{ error }}</span>
    <div class="form-group">
    <div class="input-icon">

Error message given would be "CSRF verification failed or Request Error"

0

There are 0 best solutions below