djangoのデフォルトのパスワードリセット機能を使用しています。ページが見つかりません(404)djangoでリセットパスワードの電子メールリンクが間違っているとエラーが発生しました
URLが正しい場合は問題ありません。今、私が間違っているか無効なリンクを置くならば、私は、
The current URL, account/reset/NTQ/4ox-7f135b9b74e7a4aa909fdd/, didn't match any of these.
アカウント/ urls.py取得 -
url(r'^password_reset/$', auth_views.password_reset, name='password_reset'),
url(r'^password_reset/done/$', auth_views.password_reset_done, name='password_reset_done'),
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
auth_views.password_reset_confirm, name='password_reset_confirm'),
#url(r'^reset/',auth_views.password_reset_confirm, name='empty_password_reset_confirm'),
url(r'^reset/done/$', auth_views.password_reset_complete, name='password_reset_complete'),
テンプレートpassword_reset_confirm.html -
{% extends 'base.html' %}
{% block content %}
{% if validlink %}
<h3>Change password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Change password</button>
</form>
{% else %}
<p>
The password reset link was invalid, possibly because it has already been used.
Please request a new password reset.
</p>
{% endif %}
{% endblock %}
私が試しました -
url(r'^reset/',auth_views.password_reset_confirm, name='empty_password_reset_confirm')
しかし、その場合私は午前取得するAssertionError at /account/reset/NTQ/4ox-7f135b9b74e7a4aa909fdd/
非常に助けていただきありがとうございます。
あなたは現在の意図された動作について説明しました。しかし、代わりに何をしたいですか? –
URLが間違っていると、404エラーが表示されません。代わりに、 'password_reset_confirm.html'ファイルの' else'部分を表示する必要があります。 –