0
votes

After installing django-registration-redux I have an 403 CSRF Error each time I try to register. Here is my form.html:

{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}



{% block content %}
<div class="space"></div>
<div class="space"></div>
<div class="space"></div>
<div class="space"></div>
<div class='row'>
<div class='col-sm-6 col-sm-offset-3'>
<h1>Înregistrare</h1>
<form method="post" action=".">
  {% csrf_token %}
  {{ form|crispy }}

  <input class='btn btn-block btn-primary' type="submit" value="{% trans 'Join' %}" />
</form>
</div>
</div>

<hr/>
<div class='row'>
<div class='col-sm-6 col-sm-offset-3 text-align-center'>
<p>Doriți să vă <a href="{% url 'auth_login' %}">Logați</a>?</p>
</div>
</div>


{% endblock %}

1)Yes, I do have both {% csrf_token %} in the form.html and the following MIDDLEWARE_CLASSES :

= (
    'djangosecure.middleware.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)
1
Is there anything interesting logged to the terminal?aisbaa
"Reason given for failure: CSRF token missing or incorrect"Vasile
I really don't understand WHY?????? This is crazy. It writes me that I have no CSRF token WHEN IT IS IN THE FORMVasile
Can you inspect request in developer tools?aisbaa

1 Answers

1
votes

I have the same problem after i update my django from 1.8 to 1.10. downgrading to 1.8 fix the problem (for now)..