Move tokenserializer import after otpseed definition
This commit is contained in:
parent
dabe6a08ac
commit
d9ee4ffc80
1 changed files with 3 additions and 2 deletions
|
@ -1,9 +1,8 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import AbstractUser
|
from django.contrib.auth.models import AbstractUser
|
||||||
|
|
||||||
from rest_framework import exceptions
|
from rest_framework import exceptions
|
||||||
from rest_framework import authentication
|
from rest_framework import authentication
|
||||||
from otpauth.serializer import TokenSerializer
|
|
||||||
|
|
||||||
class OTPSeed(AbstractUser):
|
class OTPSeed(AbstractUser):
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
|
@ -17,6 +16,8 @@ class OTPSeed(AbstractUser):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "'{}'@{}".format(self.name, self.realm)
|
return "'{}'@{}".format(self.name, self.realm)
|
||||||
|
|
||||||
|
from otpauth.serializer import TokenSerializer
|
||||||
|
|
||||||
class OTPAuthentication(authentication.BaseAuthentication):
|
class OTPAuthentication(authentication.BaseAuthentication):
|
||||||
def authenticate(self, request):
|
def authenticate(self, request):
|
||||||
serializer = TokenSerializer(data=request.data)
|
serializer = TokenSerializer(data=request.data)
|
||||||
|
|
Loading…
Reference in a new issue