django - 链接到 django 密码重置不显示
问题描述
密码重置的链接未显示密码重置的 控制台输出 您好,有人要求为电子邮件地址 root@gmail.com 重置密码,请点击以下链接:http: //127.0.0.1 :8000 {% url ' password_reset_confirm' uidb64=uid token=token %}
HTML 文件
password_reset.html
<form action="" method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="send password reset email" name="submit" />
</form>
password_reset_email.html
Hi there, Someone asked for a password reset for the email
address {{ email }}, Follow the link below: {{ protocol }}://
{{ domain}} {% url'password_reset_confirm' uidb64=uid token=token %}
password_reset_confirm.html
<div>
{% if validlink %}
<h2>change password for 0{{ form.user.username }}</h2>
<form action="" method="POST" novalidate>
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="changepassword" name="submit" />
</form>
{% else %}
<h3>Reset your password</h3>
<p>it looks like you clicked on an invalid passowrd reset link try again</p>
<a href="{% url 'password_reset' %}">Request</a>
{% endif %}
</div>
设置.py
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
帐户/urls.py
path("accounts/", include("django.contrib.auth.urls")),
解决方案
我遇到了同样的问题,我所要做的就是将代码放在同一行。
{{ protocol }}://{{ domain }}{% url "password_reset_confirm" uidb64=uid token=token %}
- 确保代码没有分成新行。
推荐阅读
- android - Kotlin 多平台配置问题
- javascript - JavaScript:关于传入 `addEventListener` 的回调的混淆
- c++ - 如何让 clangd 完成器与 Unrealengine-4 一起工作
- c++ - 在 wxEntry(argc, argv) 之前来自 wxWIdgets (3.1.4) 的 wxMessageBox() 类;警告使用缺少的 CPU 指令集
- c++ - 使用 const 实现 unordered_map 迭代器的问题
- python - 在 python3 中使用 re.sub() 从字符串中删除除给定字母后面的数字之外的所有数字
- javascript - css 文件更改时的平滑过渡
- amazon-web-services - 是否可以在没有 VPC 连接的情况下将 AWS Lambda 函数连接到 AWS EFS?
- react-native - 如何在本机反应中转到另一个页面?
- c++ - 我收到 Cmake 编译器错误“-lc++ 和 -lSystem”