feat: allow admin to update user password without viewing it
This commit is contained in:
parent
d7cf96978a
commit
bb4f7c2d08
@ -81,6 +81,11 @@ def edit_user(user_id):
|
||||
return jsonify({'message': 'User not found!'}), 404
|
||||
user.username = data.get('username', user.username)
|
||||
user.role = data.get('role', user.role)
|
||||
|
||||
# Update password if provided
|
||||
if 'password' in data:
|
||||
user.password = generate_password_hash(data['password'])
|
||||
|
||||
db.session.commit()
|
||||
return jsonify({'message': 'User updated!'}), 200
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user