Example #1
0
 async def _update_user(user: models.BaseUserDB, update_dict: Dict[str, Any]):
     for field in update_dict:
         if field == "password":
             hashed_password = get_password_hash(update_dict[field])
             user.hashed_password = hashed_password
         else:
             setattr(user, field, update_dict[field])
     return await user_db.update(user)
Example #2
0
 async def _update_user(user: models.BaseUserDB,
                        update_dict: Dict[str, Any], request: Request):
     for field in update_dict:
         if field == "password":
             hashed_password = get_password_hash(update_dict[field])
             user.hashed_password = hashed_password
         else:
             setattr(user, field, update_dict[field])
     updated_user = await user_db.update(user)
     if after_update:
         await run_handler(after_update, updated_user, update_dict, request)
     return updated_user