Fix broken token authentication
This commit is contained in:
parent
3abdd9b180
commit
a73fba0f1b
@ -10,7 +10,7 @@ EXPIRE_HOURS = getattr(settings, 'REST_FRAMEWORK_TOKEN_EXPIRE_HOURS', 24)
|
|||||||
|
|
||||||
class ExpiringTokenAuthentication(TokenAuthentication):
|
class ExpiringTokenAuthentication(TokenAuthentication):
|
||||||
def authenticate_credentials(self, key):
|
def authenticate_credentials(self, key):
|
||||||
print(key)
|
#print(key)
|
||||||
try:
|
try:
|
||||||
token = Token.objects.get(key=key)
|
token = Token.objects.get(key=key)
|
||||||
except Token.DoesNotExist:
|
except Token.DoesNotExist:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import User, Group
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from rest_framework import viewsets, status
|
from rest_framework import viewsets, status
|
||||||
from rest_framework import permissions
|
from rest_framework import permissions
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
@ -39,6 +39,8 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'parts.apps.PartsConfig',
|
'parts.apps.PartsConfig',
|
||||||
|
'api.apps.ApiConfig',
|
||||||
|
'rest_framework.authtoken',
|
||||||
'qr_code',
|
'qr_code',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'crispy_forms',
|
'crispy_forms',
|
||||||
|
@ -56,6 +56,8 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'parts.apps.PartsConfig',
|
'parts.apps.PartsConfig',
|
||||||
|
'api.apps.ApiConfig',
|
||||||
|
'rest_framework.authtoken',
|
||||||
'qr_code',
|
'qr_code',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'crispy_forms',
|
'crispy_forms',
|
||||||
|
Loading…
Reference in New Issue
Block a user