(self, user: models.UP, update_dict: dict[str, Any])
| 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 | |
| 687 | class UUIDIDMixin: |
no test coverage detected