P
P
PcheI12020-12-13 23:56:39
Django
PcheI1, 2020-12-13 23:56:39

Why doesn't django's built-in authentication system work?

I made the django authentication system according to the tutorials and at the moment of resetting the password, something went wrong (When entering soap on password_reset and sending a request, django swears that it doesn’t know who password_reset_done is, although it’s kind of like her view, and gives an error on the screen.
5fd67fce5d36f771033074.png

password_reset_form.html:

{% extends "_base.html" %}

{% block title %}Reset your password{% endblock %}

{% load static %}

{% block head %}
 <link href="{% static 'styles/registration.css' %}" rel="stylesheet" type="text/css">
{% endblock %}

{% block main %}
<div class="password-reset-form">
    <h1>Forgotten your password?</h1>
    <p>Enter your e-mail address to obtain a new password.</p>
    <form method="post" action=".">
        {{ form.as_p }}
    <p><input type="submit" value="Send e-mail"></p>
        {% csrf_token %}
    </form>
</div>
{% endblock %}


If I'm really stupid, don't hit me, I'm just learning)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PcheI1, 2020-12-15
@PcheI1

Either I'm very unlucky, or it's not customary to answer here) If someone has a similar problem, then you need to put password_reset separately in the urls and write success_url=reverse_lazy("application:password_reset_done")

from django.contrib.auth import views
from django.urls import path, include, reverse_lazy

from applications.account.apps import AccountConfig
from applications.account.views.registration import SignUpView

app_name = AccountConfig.label

urlpatterns = [
    ....
    path("password_reset/", views.PasswordResetView.as_view(success_url=reverse_lazy("account:password_reset_done"))),
    path("", include("django.contrib.auth.urls"), name="account"),
    path("registration/", SignUpView.as_view(), name="registration")
    ....
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question