fix user password bug
This commit is contained in:
@@ -14,6 +14,7 @@ from apps.authentication.models import (
|
||||
BankAccountInformation
|
||||
)
|
||||
from apps.authorization import models as authorize_models
|
||||
from django.contrib.auth.hashers import make_password
|
||||
import typing
|
||||
|
||||
|
||||
@@ -133,8 +134,10 @@ class UserSerializer(serializers.ModelSerializer):
|
||||
def update(self, instance, validated_data):
|
||||
""" update user instance """
|
||||
instance.username = validated_data.get('username', instance.username)
|
||||
|
||||
# control password
|
||||
if validated_data.get('password'):
|
||||
instance.password = validated_data.get('password', instance.password)
|
||||
instance.password = make_password(validated_data.get('password', instance.password))
|
||||
instance.first_name = validated_data.get('first_name')
|
||||
instance.last_name = validated_data.get('last_name')
|
||||
instance.is_active = validated_data.get('is_active')
|
||||
|
||||
Reference in New Issue
Block a user