diff --git a/flask_appbuilder/security/sqla/apis/user/api.py b/flask_appbuilder/security/sqla/apis/user/api.py index 94f250123d..d1b062c30e 100644 --- a/flask_appbuilder/security/sqla/apis/user/api.py +++ b/flask_appbuilder/security/sqla/apis/user/api.py @@ -68,8 +68,6 @@ class UserApi(ModelRestApi): def pre_update(self, item): item.changed_on = datetime.now() item.changed_by_fk = g.user.id - if item.password: - item.password = generate_password_hash(item.password) def pre_add(self, item): item.password = generate_password_hash(item.password) @@ -204,6 +202,9 @@ def put(self, pk): if "roles" in item.keys(): model.roles = roles + if "password" in item: + model.password = generate_password_hash(item["password"]) + self.pre_update(model) self.datamodel.edit(model, raise_exception=True) return self.response(