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


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

5/12/2016 8:35:35 PM

Accepted Answer

Django comes with a user authentication system. It handles user accounts, groups, permissions and cookie-based user sessions. This document explains how things work.

How to change Django passwords

See the Changing passwords section

  1. Navigation to your project where file lies

  2. $ python shell

  3. type below scripts :

from django.contrib.auth.models import User
u = User.objects.get(username__exact='john')
u.set_password('new password')

You can also use the simple command: changepassword *username*

Just enter the new password twice.

from the Changing passwords section in the docs.

If you have the django.contrib.admin in your INSTALLED_APPS, you can visit: which will have a form to confirm your old password and enter the new password twice.

2/26/2014 8:11:28 PM

You can also just use the django.contrib.auth.views.password_change view in your URLconf. It uses a default form and template; supplying your own is optional.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow