How to allow users to change their own passwords in Django?

前端 未结 9 1379
梦如初夏
梦如初夏 2021-01-30 03:57

Can any one point me to code where users can change their own passwords in Django?

9条回答
  •  礼貌的吻别
    2021-01-30 04:36

    Very similar to @Ciro's answer, but more specific to the original question (without adding all the authentication views):

    just add to urlpatterns in urls.py:

    url('^change-password/$', auth_views.password_change, {'post_change_redirect': 'next_page'}, name='password_change'),
    

    Note that post_change_redirect specifies the url to redirect after the password is changed.

    Then, just add to your template:

    Change Password
    

提交回复
热议问题