mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
Add hashed_password argument to do_change_password.
This way we're not directly manipulating user.password() in random management commands. (imported from commit e6e32ae422015ab55184d5d8111148793a8aca36)
This commit is contained in:
@@ -443,9 +443,14 @@ def do_activate_user(user_profile, log=True, join_date=timezone.now()):
|
||||
'user': user.email,
|
||||
'domain': domain})
|
||||
|
||||
def do_change_password(user_profile, password, log=True, commit=True):
|
||||
def do_change_password(user_profile, password, log=True, commit=True,
|
||||
hashed_password=False):
|
||||
user = user_profile.user
|
||||
user.set_password(password)
|
||||
if hashed_password:
|
||||
# This is a hashed password, not the password itself.
|
||||
user.password = password
|
||||
else:
|
||||
user.set_password(password)
|
||||
if commit:
|
||||
user.save(update_fields=["password"])
|
||||
if log:
|
||||
|
||||
Reference in New Issue
Block a user