# Path: amon/utils/generators.py
# def random_id_generator(size=32, chars=string.ascii_lowercase + string.digits):
#     return ''.join(random.choice(chars) for _ in range(size))


from django.db import models
from django.conf import settings
from django.contrib.auth.models import (
    AbstractBaseUser,
    BaseUserManager,
    PermissionsMixin
)
from django.utils import timezone
from datetime import datetime, timedelta
from amon.utils.generators import random_id_generator


    def get_short_name(self):
        return self.email

    def get_username(self):
        return self.email

    def __str__(self):
        return "Email: {0}".format(self.email)

    class Meta:
        verbose_name = 'User'



class ResetPasswordCode(models.Model):
    user = models.ForeignKey(
        settings.AUTH_USER_MODEL,
        related_name='user_password_reset_code',
        on_delete=models.CASCADE
    )
    code = models.CharField(max_length=128)
    expires_on = models.DateTimeField(auto_now=False, auto_now_add=False)
    date_created = models.DateTimeField(('date created'), default=timezone.now)


    @staticmethod
    def generate_password_reset_token(user):
        activation_code = ResetPasswordCode.objects.create(
            user=user,

# Path: amon/utils/generators.py
# def random_id_generator(size=32, chars=string.ascii_lowercase + string.digits):
#     return ''.join(random.choice(chars) for _ in range(size))


# Path: amon/apps/users/models.py
from django.db import models
from django.conf import settings
from django.contrib.auth.models import (
    AbstractBaseUser,
    BaseUserManager,
    PermissionsMixin
)
from django.utils import timezone
from datetime import datetime, timedelta
from amon.utils.generators import random_id_generator


    def get_short_name(self):
        return self.email

    def get_username(self):
        return self.email

    def __str__(self):
        return "Email: {0}".format(self.email)

    class Meta:
        verbose_name = 'User'



class ResetPasswordCode(models.Model):
    user = models.ForeignKey(
        settings.AUTH_USER_MODEL,
        related_name='user_password_reset_code',
        on_delete=models.CASCADE
    )
    code = models.CharField(max_length=128)
    expires_on = models.DateTimeField(auto_now=False, auto_now_add=False)
    date_created = models.DateTimeField(('date created'), default=timezone.now)


    @staticmethod
    def generate_password_reset_token(user):
        activation_code = ResetPasswordCode.objects.create(
            user=user,

            code=random_id_generator(size=64),
