Ensure UserUpdatePasswordSchema only loads _password

We had the `only` defined in the Meta class, and this wasn't working -
any extra fields were also being loaded. This moves it to the point
where the class is instantiated, which now works.
This commit is contained in:
Katie Smith
2022-05-06 09:49:31 +01:00
parent 685959de00
commit dd213b8d55

View File

@@ -180,7 +180,6 @@ class UserUpdatePasswordSchema(BaseSchema):
class Meta(BaseSchema.Meta):
model = models.User
only = ('password')
strict = True
@validates_schema(pass_original=True)
@@ -716,7 +715,7 @@ class UnarchivedTemplateSchema(BaseSchema):
# should not be used on its own for dumping - only for loading
create_user_schema = UserSchema()
user_update_schema_load_json = UserUpdateAttributeSchema(load_json=True, partial=True)
user_update_password_schema_load_json = UserUpdatePasswordSchema(load_json=True, partial=True)
user_update_password_schema_load_json = UserUpdatePasswordSchema(only=('_password',), load_json=True, partial=True)
service_schema = ServiceSchema()
detailed_service_schema = DetailedServiceSchema()
template_schema = TemplateSchema()