schemas: better email type

This commit is contained in:
Luna 2019-04-25 21:29:52 -03:00
parent 7c5ef967f6
commit c9a7b3dfb5
1 changed files with 2 additions and 5 deletions

View File

@ -74,7 +74,7 @@ class LitecordValidator(Validator):
def _validate_type_email(self, value: str) -> bool: def _validate_type_email(self, value: str) -> bool:
"""Validate against the email regex.""" """Validate against the email regex."""
return bool(EMAIL_REGEX.match(value)) return bool(EMAIL_REGEX.match(value)) and len(value) < 256
def _validate_type_b64_icon(self, value: str) -> bool: def _validate_type_b64_icon(self, value: str) -> bool:
return bool(DATA_REGEX.match(value)) return bool(DATA_REGEX.match(value))
@ -235,11 +235,8 @@ USER_UPDATE = {
'dependencies': 'password', 'nullable': True 'dependencies': 'password', 'nullable': True
}, },
# TODO: maybe an email type?
'email': { 'email': {
'type': 'string', 'minlength': 2, 'type': 'email', 'required': False, 'dependencies': 'password',
'maxlength': 30, 'required': False,
'dependencies': 'password',
}, },
'avatar': { 'avatar': {