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


from datetime import timedelta
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.db import models
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from userprofiles.settings import up_settings
import hashlib
import random
import re
import uuid

        send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [new_user.email])

        return new_user

    def create_verification(self, user):
        salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
        activation_key = hashlib.sha1(salt + str(uuid.uuid4())).hexdigest()
        return self.create(user=user, activation_key=activation_key)

    def delete_expired_users(self):
        for verification in self.all():
            if verification.activation_key_expired():
                user = verification.user
                if not user.is_active:
                    user.delete()


class AccountVerification(models.Model):
    ACTIVATED = 'ALREADY_ACTIVATED'

    user = models.ForeignKey(User, unique=True, verbose_name=_('User'))
    activation_key = models.CharField(_('Activation key'), max_length=40)

    objects = AccountVerificationManager()

    def __unicode__(self):
        return u'Account verification: %s' % self.user

    def activation_key_expired(self):

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


# Path: userprofiles/contrib/accountverification/models.py
from datetime import timedelta
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.db import models
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from userprofiles.settings import up_settings
import hashlib
import random
import re
import uuid


        send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [new_user.email])

        return new_user

    def create_verification(self, user):
        salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
        activation_key = hashlib.sha1(salt + str(uuid.uuid4())).hexdigest()
        return self.create(user=user, activation_key=activation_key)

    def delete_expired_users(self):
        for verification in self.all():
            if verification.activation_key_expired():
                user = verification.user
                if not user.is_active:
                    user.delete()


class AccountVerification(models.Model):
    ACTIVATED = 'ALREADY_ACTIVATED'

    user = models.ForeignKey(User, unique=True, verbose_name=_('User'))
    activation_key = models.CharField(_('Activation key'), max_length=40)

    objects = AccountVerificationManager()

    def __unicode__(self):
        return u'Account verification: %s' % self.user

    def activation_key_expired(self):

        expiration_date = timedelta(days=up_settings.ACCOUNT_VERIFICATION_DAYS)