# 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
        return False

    def create_inactive_user(self, username, password, email):
        new_user = User.objects.create_user(username, email, password)
        new_user.is_active = False
        new_user.save()

        account_verification = self.create_verification(new_user)
        current_site = Site.objects.get_current()

        subject = ''.join(render_to_string(
            'userprofiles/mails/activation_email_subject.html',
            {'site': current_site}).splitlines())

        message = render_to_string('userprofiles/mails/activation_email.html', {
            'activation_key': account_verification.activation_key,
            'expiration_days': up_settings.ACCOUNT_VERIFICATION_DAYS,
            'site': current_site})

        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():

# 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

        return False

    def create_inactive_user(self, username, password, email):
        new_user = User.objects.create_user(username, email, password)
        new_user.is_active = False
        new_user.save()

        account_verification = self.create_verification(new_user)
        current_site = Site.objects.get_current()

        subject = ''.join(render_to_string(
            'userprofiles/mails/activation_email_subject.html',
            {'site': current_site}).splitlines())

        message = render_to_string('userprofiles/mails/activation_email.html', {
            'activation_key': account_verification.activation_key,
            'expiration_days': up_settings.ACCOUNT_VERIFICATION_DAYS,
            'site': current_site})

        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():