def combined_validator(mail, nr, code, passwd):
    if not validators.email_validator(mail):
        raise Exception("Email is not valid")
    elif not validators.phone_validator(nr):
        raise Exception("Phone number is not valid")
    elif not validators.postal_validator(code):
        raise Exception("Postal code is not valid")
    elif not validators.password_check(passwd):
        raise Exception("Password is not valid")
Esempio n. 2
0
    def convert(self, value: str, param, context) -> str:
        """The function which will perform validation or normalization

        Arguments:
            value (str): The email address

        Returns:
            str: The normalized and validated email address
        """
        ## Lower case email
        email = f"{value.lower()}"

        ## Check if the email is valid
        if not email_validator(email):
            self.fail(f'Could not validate "{value!r}" as an email address')

        ## Return the lower case domain
        return email
Esempio n. 3
0
 def validate(self, value):
     super().validate(value)
     if value is None:
         return
     if email_validator(value) is not True:
         raise errors.bad_request.InvalidEmailAddress()
Esempio n. 4
0
 def _validate_email_format(self, email=None):
     __email = email or self.email
     if not email_validator(__email):
         raise KeyError("Email is invalid format.")
     else:
         return None
Esempio n. 5
0
def combined_validator(email, password, phone_number, postal_code):
    if not (email_validator(email) and strong_password_detection(password)
            and phone_number_validator(phone_number)
            and postal_code_validator(postal_code)):
        raise Exception("Incorrect data")
Esempio n. 6
0
 def valid_uri(self, key, email):
     assert email_validator(email)
     return email