'''Auth urls解读'''
urlpatterns = [
url(r'^login/$', views.LoginView.as_view(), name='login'),
url(r'^logout/$', views.LogoutView.as_view(), name='logout'),
url(r'^password_change/$', views.PasswordChangeView.as_view(), name='password_change'),
url(r'^password_change/done/$', views.PasswordChangeDoneView.as_view(), name='password_change_done'),
url(r'^password_reset/$', views.PasswordResetView.as_view(), name='password_reset'),
url(r'^password_reset/done/$', views.PasswordResetDoneView.as_view(), 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})/$',
views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
url(r'^reset/done/$', views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
]
'''
__init__.py login/logout/authenticate/3大函数;源码自己看
#1.login登录view 会验证当前user;验证通过会通过session存储user_id,并且会把当前request.user=user;验证失败会返回 匿名User类
1.需要自定义'registration/login.html'模板文件
2.需要自定义'LOGIN_REDIRECT_URL'
#2.logout注销view
1.需要自定义'registration/login.html'模板文件
2.flush session
3.定义LOGOUT_REDIRECT_URL = '/accounts/login/'
#3.password_change 修改密码view
1.需要自定义'registration/password_change_form.html'
#4.password_change/done 修改密码成功后的页面
1.需要自定义'registration/password_change_done.html'
#5.password_reset 重置密码view
1.django是通过发送邮件给用户来充值密码的
2.需要设置email服务
EMAIL_HOST = "smtp.sina.com"
EMAIL_PORT = 25
EMAIL_HOST_USER = "**" # 你的邮箱账号
EMAIL_HOST_PASSWORD = "**" # 你的邮箱生成的授权码(ps:新浪简单;QQ麻烦)
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
#6.password_reset_done 发送邮件成功的页面
1.需要自定义'registration/password_reset_done.html'
#7.password_reset_confirm 接收邮件的人用来点击的url,用来重置密码用的
1.需要自定义'registration/password_reset_form.html'
#8.password_reset_complete 重置密码成功的页面
1.需要自定义'registration/password_reset_complete.html'
'''