# Path: apps/auth/models.py
# class KipptUser(AbstractUser):
#     """
#     Defines our custom user model and fields
# 
#     """
#     api_token = models.CharField(max_length=255)
#     list_id = models.IntegerField(blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.username
# 
#     def kippt_client(self):
#         return Kippt(self.username, api_token=self.api_token)


from django.contrib.auth.backends import ModelBackend
from .models import KipptUser



class KipptUserBackend(ModelBackend):
    def authenticate(self, username=None, api_token=None):
        try:

# Path: apps/auth/models.py
# class KipptUser(AbstractUser):
#     """
#     Defines our custom user model and fields
# 
#     """
#     api_token = models.CharField(max_length=255)
#     list_id = models.IntegerField(blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.username
# 
#     def kippt_client(self):
#         return Kippt(self.username, api_token=self.api_token)


# Path: apps/auth/backends.py
from django.contrib.auth.backends import ModelBackend
from .models import KipptUser




class KipptUserBackend(ModelBackend):
    def authenticate(self, username=None, api_token=None):
        try:

            return KipptUser.objects.get(username=username, api_token=api_token)