# Path: userprofiles/settings.py
# class Settings(object):
#     def __init__(self, **kwargs):
#     def __getattr__(self, key):
# def validate_settings():


import uuid
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from userprofiles.settings import up_settings
            from userprofiles.contrib.emailverification.models import EmailVerification
            from userprofiles.contrib.accountverification.models import AccountVerification
            self.fields['username'].widget = forms.widgets.HiddenInput()
            self.fields['username'].required = False

    def _generate_username(self):
        """ Generate a unique username """
        while True:
            # Generate a UUID username, removing dashes and the last 2 chars
            # to make it fit into the 30 char User.username field. Gracefully
            # handle any unlikely, but possible duplicate usernames.
            username = str(uuid.uuid4())
            username = username.replace('-', '')
            username = username[:-2]

            try:
                User.objects.get(username=username)
            except User.DoesNotExist:
                return username

    def clean_username(self):
        if up_settings.EMAIL_ONLY:
            username = self._generate_username()
        else:
            username = self.cleaned_data['username']
            if User.objects.filter(username__iexact=username):
                raise forms.ValidationError(
                    _(u'A user with that username already exists.'))

        return username

    def clean_email(self):

# Path: userprofiles/settings.py
# class Settings(object):
#     def __init__(self, **kwargs):
#     def __getattr__(self, key):
# def validate_settings():


# Path: userprofiles/forms.py
import uuid
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from userprofiles.settings import up_settings
            from userprofiles.contrib.emailverification.models import EmailVerification
            from userprofiles.contrib.accountverification.models import AccountVerification

            self.fields['username'].widget = forms.widgets.HiddenInput()
            self.fields['username'].required = False

    def _generate_username(self):
        """ Generate a unique username """
        while True:
            # Generate a UUID username, removing dashes and the last 2 chars
            # to make it fit into the 30 char User.username field. Gracefully
            # handle any unlikely, but possible duplicate usernames.
            username = str(uuid.uuid4())
            username = username.replace('-', '')
            username = username[:-2]

            try:
                User.objects.get(username=username)
            except User.DoesNotExist:
                return username

    def clean_username(self):
        if up_settings.EMAIL_ONLY:
            username = self._generate_username()
        else:
            username = self.cleaned_data['username']
            if User.objects.filter(username__iexact=username):
                raise forms.ValidationError(
                    _(u'A user with that username already exists.'))

        return username

    def clean_email(self):

        if not up_settings.CHECK_UNIQUE_EMAIL: