# Path: amon/apps/users/models.py
# class AmonUserManager(BaseUserManager):
# class AmonUser(AbstractBaseUser, PermissionsMixin):
#     class Meta:
# class ResetPasswordCode(models.Model):
#     def create_user(self, email=None, password=None):
#     def create_superuser(self, email, password=None):
#     def get_short_name(self):
#     def get_username(self):
#     def __str__(self):
#     def generate_password_reset_token(user):
#     def __str__(self):
#     USERNAME_FIELD = 'email'


import hashlib
import uuid
from django import forms
from annoying.functions import get_object_or_None
from django.contrib.auth import get_user_model
from amon.utils.dates import unix_utc_now
from amon.apps.users.models import invite_model






User = get_user_model()


class InviteForm(forms.Form):

    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user', None)
        super(InviteForm, self).__init__(*args, **kwargs)


    email = forms.EmailField(required=True, widget=forms.TextInput(attrs={'placeholder': 'Email'}))



    def clean_email(self):
        cleaned_data = self.cleaned_data

        email = cleaned_data['email']

        # Check if invitation already exists

# Path: amon/apps/users/models.py
# class AmonUserManager(BaseUserManager):
# class AmonUser(AbstractBaseUser, PermissionsMixin):
#     class Meta:
# class ResetPasswordCode(models.Model):
#     def create_user(self, email=None, password=None):
#     def create_superuser(self, email, password=None):
#     def get_short_name(self):
#     def get_username(self):
#     def __str__(self):
#     def generate_password_reset_token(user):
#     def __str__(self):
#     USERNAME_FIELD = 'email'


# Path: amon/apps/users/forms.py
import hashlib
import uuid
from django import forms
from annoying.functions import get_object_or_None
from django.contrib.auth import get_user_model
from amon.utils.dates import unix_utc_now
from amon.apps.users.models import invite_model






User = get_user_model()


class InviteForm(forms.Form):

    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user', None)
        super(InviteForm, self).__init__(*args, **kwargs)


    email = forms.EmailField(required=True, widget=forms.TextInput(attrs={'placeholder': 'Email'}))



    def clean_email(self):
        cleaned_data = self.cleaned_data

        email = cleaned_data['email']

        # Check if invitation already exists

        email_count = invite_model.collection.find({'email': email}).count()
