MCPcopy Index your code
hub / github.com/fastapi-users/fastapi-users / _update

Method _update

fastapi_users/manager.py:667–684  ·  view source on GitHub ↗
(self, user: models.UP, update_dict: dict[str, Any])

Source from the content-addressed store, hash-verified

665 return user
666
667 async def _update(self, user: models.UP, update_dict: dict[str, Any]) -> models.UP:
668 validated_update_dict = {}
669 for field, value in update_dict.items():
670 if field == "email" and value != user.email:
671 try:
672 await self.get_by_email(value)
673 raise exceptions.UserAlreadyExists()
674 except exceptions.UserNotExists:
675 validated_update_dict["email"] = value
676 validated_update_dict["is_verified"] = False
677 elif field == "password" and value is not None:
678 await self.validate_password(value, user)
679 validated_update_dict["hashed_password"] = self.password_helper.hash(
680 value
681 )
682 else:
683 validated_update_dict[field] = value
684 return await self.user_db.update(user, validated_update_dict)
685
686
687class UUIDIDMixin:

Callers 3

verifyMethod · 0.95
reset_passwordMethod · 0.95
updateMethod · 0.95

Calls 4

get_by_emailMethod · 0.95
validate_passwordMethod · 0.95
hashMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected