# Path: quora/settings.py
# ALLOWED_SIGNUP_DOMAINS = ['*']


from django import forms
from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
from quora.settings import ALLOWED_SIGNUP_DOMAINS

def SignupDomainValidator(value):
    if '*' not in ALLOWED_SIGNUP_DOMAINS:
        try:
            domain = value[value.index("@"):]
            if domain not in ALLOWED_SIGNUP_DOMAINS:
                raise ValidationError(u'Invalid domain. Allowed domains on this network: {0}'.format(','.join(ALLOWED_SIGNUP_DOMAINS)))
        except Exception, e:

# Path: quora/settings.py
# ALLOWED_SIGNUP_DOMAINS = ['*']


# Path: quora/profile/forms.py
from django import forms
from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
from quora.settings import ALLOWED_SIGNUP_DOMAINS


def SignupDomainValidator(value):
    if '*' not in ALLOWED_SIGNUP_DOMAINS:
        try:
            domain = value[value.index("@"):]
            if domain not in ALLOWED_SIGNUP_DOMAINS:
                raise ValidationError(u'Invalid domain. Allowed domains on this network: {0}'.format(','.join(ALLOWED_SIGNUP_DOMAINS)))
        except Exception, e:

            raise ValidationError(u'Invalid domain. Allowed domains on this network: {0}'.format(','.join(ALLOWED_SIGNUP_DOMAINS)))