Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updating user using FAB security api breaking user password hash #2179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions flask_appbuilder/security/sqla/apis/user/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
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)
Expand Down Expand Up @@ -204,6 +202,9 @@
if "roles" in item.keys():
model.roles = roles

if "password" in item:
model.password = generate_password_hash(item["password"])

Check warning on line 206 in flask_appbuilder/security/sqla/apis/user/api.py

View check run for this annotation

Codecov / codecov/patch

flask_appbuilder/security/sqla/apis/user/api.py#L205-L206

Added lines #L205 - L206 were not covered by tests

self.pre_update(model)
self.datamodel.edit(model, raise_exception=True)
return self.response(
Expand Down
Loading