|
|
|
@ -13,7 +13,7 @@ from marshmallow.types import UnknownOption |
|
|
|
from marshmallow.validate import Length, Regexp |
|
|
|
|
|
|
|
from tildes.lib.password import is_breached_password |
|
|
|
from tildes.schemas.context import TildesSchemaContext, TildesContext |
|
|
|
from tildes.schemas.context import TildesSchemaContext, TildesSchemaContextDict |
|
|
|
from tildes.schemas.fields import Markdown |
|
|
|
|
|
|
|
|
|
|
|
@ -65,7 +65,9 @@ class UserSchema(Schema): |
|
|
|
def anonymize_username(self, data: dict, many: bool) -> dict: |
|
|
|
"""Hide the username if the dumping context specifies to do so.""" |
|
|
|
# pylint: disable=unused-argument |
|
|
|
if not TildesSchemaContext.get(default=TildesContext()).get("hide_username"): |
|
|
|
if not TildesSchemaContext.get(default=TildesSchemaContextDict()).get( |
|
|
|
"hide_username" |
|
|
|
): |
|
|
|
return data |
|
|
|
|
|
|
|
if "username" not in data: |
|
|
|
@ -104,7 +106,7 @@ class UserSchema(Schema): |
|
|
|
Requires check_breached_passwords be True in the schema's context. |
|
|
|
""" |
|
|
|
# pylint: disable=unused-argument |
|
|
|
if not TildesSchemaContext.get(default=TildesContext()).get( |
|
|
|
if not TildesSchemaContext.get(default=TildesSchemaContextDict()).get( |
|
|
|
"check_breached_passwords" |
|
|
|
): |
|
|
|
return |
|
|
|
@ -124,7 +126,7 @@ class UserSchema(Schema): |
|
|
|
Requires username_trim_whitespace be True in the schema's context. |
|
|
|
""" |
|
|
|
# pylint: disable=unused-argument |
|
|
|
if not TildesSchemaContext.get(default=TildesContext()).get( |
|
|
|
if not TildesSchemaContext.get(default=TildesSchemaContextDict()).get( |
|
|
|
"username_trim_whitespace" |
|
|
|
): |
|
|
|
return data |
|
|
|
|