Super菜的专栏

keep fighting!

30学习写论坛-8

django 自带的认证系统

http://python.usyiyi.cn/django/topics/auth/default.html
from django.contrib.auth import views

^login/$ [name='login']
^logout/$ [name='logout']
^password_change/$ [name='password_change']
^password_change/done/$ [name='password_change_done']
^password_reset/$ [name='password_reset']
^password_reset/done/$ [name='password_reset_done']
^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$ [name='password_reset_confirm']
^reset/done/$ [name='password_reset_complete']

修改密码需要
<a href="{% url 'password_change' %}">修改密码</a>
password_change_form.html(提交修改信息的表格)
POST参数old_password、new_password1、new_password2不能改变
密码改变后会
reverse('password_change_done') 需要 password_change_done.html(修改成功,返回首页信息)


忘记密码
<a href="{% url 'password_reset' %}">忘记密码?</a>
# 4 views for password reset:
# - password_reset sends the mail
# - password_reset_done shows a success message for the above
# - password_reset_confirm checks the link the user clicked and
#   prompts for a new password
# - password_reset_complete shows a success message for the above

password_reset_form.html(填写注册邮箱,发送邮件name="email)
password_reset_done.html(邮件发送成功)
password_reset_email.html
如果想重置用户 {{ email }} 的密码. 点击下面链接:
{{ protocol}}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
password_reset_subject.txt(发邮件的标题)

点击链接重制密码
password_reset_confirm.html(修改密码的表单)(new_password1、new_password2)
password_reset_complete.html(密码重制成功的标志)


阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013820054/article/details/51555199
文章标签: django
个人分类: 前端及编程
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭