Answer the question
In order to leave comments, you need to log in
In the view.py file, change the user's password?
Can I change the user's password in view.py?
if edit_form.is_valid() and edit_userForm.is_valid() and resetPassData.is_valid():
oldPass = resetPassData.cleaned_data["old_password"]
newPass = resetPassData.cleaned_data["new_password"]
if oldPass!="" and newPass!="":
if oldPass == newPass:
print("Пароли не должны совпадать")
resPassError = "Пароли не должны совпадать"
else:
print("Пароль изменен")
Answer the question
In order to leave comments, you need to log in
Nobody reads the documentation :(
from django.contrib.auth.models import User
u = User.objects.get(username='john')
u.set_password('new password')
u.save()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question