Fix E-Mail validation error reporting
This commit is contained in:
parent
e84a73465d
commit
9dc4673b3b
@ -8,6 +8,7 @@ from marshmallow_dataclass import dataclass
|
||||
from typing import List
|
||||
|
||||
import json
|
||||
import re
|
||||
import datetime
|
||||
from BreCal.validators.time_logic import validate_time_is_in_not_too_distant_future
|
||||
from BreCal.validators.validation_base_utils import check_if_string_has_special_characters
|
||||
@ -506,7 +507,7 @@ class UserSchema(Schema):
|
||||
|
||||
@validates("user_email")
|
||||
def validate_user_email(self, value):
|
||||
if value is not None and not "@" in value:
|
||||
if value and not re.match(r"[^@]+@[^@]+\.[^@]+", value) in value:
|
||||
raise ValidationError({"user_email":f"invalid email address"})
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user