ungleich-otp/ungleichotp/otpauth/models.py
2018-11-17 21:45:53 +01:00

29 lines
775 B
Python

from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class OTPSeed(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=128)
realm = models.CharField(max_length=128)
seed = models.CharField(max_length=128)
class Meta:
unique_together = (('name', 'realm'),)
def __str__(self):
return "'{}'@{}".format(self.name, self.realm)
# class OTPUser(AbstractUser, OTPSeed):
# @classmethod
# def get_username(cls):
# pass
# @classmethod
# def check_password(cls, raw_password):
# """ receives a time based token"""
# pass
# @classmethod
# def has_usable_password(cls):
# pass