DEV Community

loading...

Discussion on: Django Authentication System - Tutorial for Beginners

Collapse
uithemes profile image
ui-themes

Thank you for writing!
Can I reset a password using the terminal?

Collapse
sm0ke profile image
Sm0ke Author

For sure - Here is the code to reset a password for an existing user:

>>> from django.contrib.auth.models import User 
>>> user = User.objects.get(email='test@whatever.com') 
>>> user.set_password('new_raw_password') 
>>> user.save() 
Enter fullscreen mode Exit fullscreen mode

P.S. the password should be in plain text (Django handles the encryption).

Collapse
uithemes profile image
ui-themes

Thanks!

Collapse
uithemes profile image
ui-themes

So easy, Ty!

Thread Thread
sm0ke profile image
Sm0ke Author

🚀🚀