def validate_email(value): from osf.models import BlacklistedEmailDomain with reraise_django_validation_errors(): django_validate_email(value) domain = value.split('@')[1].lower() if BlacklistedEmailDomain.objects.filter(domain=domain).exists(): raise BlacklistedEmailError('Invalid Email')
def validate_email(value): from osf.models import BlacklistedEmailDomain with reraise_django_validation_errors(): django_validate_email(value) domain = value.split('@')[1].lower() if BlacklistedEmailDomain.objects.filter(domain=domain).exists(): raise BlacklistedEmailError('Invalid Email')
def validate_email(email): """ Validate email, the strict or the quick way depending on `FEATURES['EMAIL_STRICT_VERIFICATION']`. """ is_strict = settings.FEATURES.get('EMAIL_STRICT_VERIFICATION', True) log.info(u'Validating user email=%(email)s, strict_verification=%(is_strict)s', { 'email': email, 'is_strict': is_strict, }) if is_strict: is_valid = strict_validate_email( email=email, check_mx=True, debug=True, ) else: try: django_validate_email(email) is_valid = True except DjangoValidationError: is_valid = False log.info(u'Validating user email=%(email)s, strict_verification=%(is_strict)s, is_valid=%(is_valid)s', { 'email': email, 'is_strict': is_strict, 'is_valid': is_valid, }) return is_valid
def validate_email_address(email): django_validate_email(email) if email.endswith('.'): raise ValidationError( 'Email cannot end with \'.\' (dot), please check again') else: return True
def validate_email_address(email): django_validate_email(email) if email.endswith('.'): raise ValidationError( "email doesn't end by (.) dot, please input valid email") else: return True
def validate_email(value): """Validate a single email.""" if not value: return False # Check the regex, using the validate_email from django. try: django_validate_email(value) except ValidationError: return False
def validate_email_address(email): try: django_validate_email(email) except ValidationError: raise ValidationError(f'{email} is not a valid email', code='invalid') if email.endswith('.'): raise ValidationError('Email cannot end with \'.\' (dot), please check again') else: return True
def validate_email(value): """Validate a single email.""" if not value: return False # Check the regex, using the validate_email from django. try: django_validate_email(value) except ValidationError: return False else: # Check with the disposable list. return True
def validate_email(value): from osf.models import NotableEmailDomain with reraise_django_validation_errors(): django_validate_email(value) domain = value.split('@')[1].lower() is_email_domain_blocked = NotableEmailDomain.objects.filter( domain=domain, note=NotableEmailDomain.Note.EXCLUDE_FROM_ACCOUNT_CREATION, ).exists() if is_email_domain_blocked: raise BlockedEmailError('Invalid Email')
def validate_email(value): """Validate a single email.""" if not value: return False # Check the regex, using the validate_email from django. try: django_validate_email(value) except ValidationError: return False else: # Check with the disposable list. try: validate_disposable_email(value) except ValidationError: return False else: return True
def validate_email_address(emailaddress): """ Checks if an email address is syntactically correct. Makes use of the django email-validator for consistency. Args: emailaddress (str): Email address to validate. Returns: bool: If this is a valid email or not. """ try: django_validate_email(str(emailaddress)) except DjangoValidationError: return False except Exception: # logger.log_trace() return False else: return True
def validate_voter(mobile, email, throw=True): if not mobile: django_validate_email(email) return if mobile: mobile = mobile.replace(' ', '') mobile = mobile.replace('-', '') if len(mobile) < 4 or not mobile[1:].isdigit or \ (mobile[0] != '+' and not mobile[0].isdigit()): m = "Malformed mobile phone number: %s" % mobile if throw: raise ValidationError(m) else: return False try: django_validate_email(email) except ValidationError, e: if throw: raise e else: return False
def validate_email(email, validate_uniqueness=False, validate_existance=False): from django.core.validators import validate_email as django_validate_email from django.core.exceptions import ValidationError from rest_framework import serializers from talos.models import Principal email = email.lower() if not email_regex.match(email): raise serializers.ValidationError('E-mail address is ill-formed.', code=constants.EMAIL_INVALID_CODE) # Validate Uniqueness if validate_uniqueness: try: Principal.objects.get(email=email) raise serializers.ValidationError( 'Principal with provided e-mail is already registered.', code=constants.EMAIL_USED_CODE) except Principal.DoesNotExist: pass # Validate non existance (User with this email should exists) if validate_existance: try: Principal.objects.get(email=email) except Principal.DoesNotExist: raise serializers.ValidationError( 'Principal with provided email not exists', code=constants.EMAIL_INVALID_CODE) try: django_validate_email(email) except ValidationError: raise serializers.ValidationError('Email is invalid', code=constants.EMAIL_INVALID_CODE) return email
def validate_email(value): with reraise_django_validation_errors(): django_validate_email(value) if value.split('@')[1].lower() in settings.BLACKLISTED_DOMAINS: raise ValidationError('Invalid Email')
def validate_email(email): return django_validate_email(email)
def validate_email(value): with reraise_django_validation_errors(): django_validate_email(value) if value.split('@')[1].lower() in settings.BLACKLISTED_DOMAINS: raise BlacklistedEmailError('Invalid Email')