Fix broken token authentication

This commit is contained in:
Mario Hüttel 2021-12-30 21:12:58 +01:00
parent 3abdd9b180
commit a73fba0f1b
4 changed files with 6 additions and 1 deletions

View File

@ -10,7 +10,7 @@ EXPIRE_HOURS = getattr(settings, 'REST_FRAMEWORK_TOKEN_EXPIRE_HOURS', 24)
class ExpiringTokenAuthentication(TokenAuthentication):
def authenticate_credentials(self, key):
print(key)
#print(key)
try:
token = Token.objects.get(key=key)
except Token.DoesNotExist:

View File

@ -1,5 +1,6 @@
from django.shortcuts import render
from django.contrib.auth.models import User, Group
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import viewsets, status
from rest_framework import permissions
from rest_framework.views import APIView

View File

@ -39,6 +39,8 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'parts.apps.PartsConfig',
'api.apps.ApiConfig',
'rest_framework.authtoken',
'qr_code',
'rest_framework',
'crispy_forms',

View File

@ -56,6 +56,8 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'parts.apps.PartsConfig',
'api.apps.ApiConfig',
'rest_framework.authtoken',
'qr_code',
'rest_framework',
'crispy_forms',