Fix some silly token auth bugs

This commit is contained in:
Tanner Collin 2023-06-20 22:37:31 +00:00
parent 6b2b99e161
commit 247d224a52

View File

@ -765,7 +765,7 @@ class StatsViewSet(viewsets.ViewSet, List):
# {'data': 'Disarmed: Partition 2'} # {'data': 'Disarmed: Partition 2'}
auth_token = request.META.get('HTTP_AUTHORIZATION', '') auth_token = request.META.get('HTTP_AUTHORIZATION', '')
if secrets.VEND_API_TOKEN and auth_token != 'Bearer ' + secrets.ALARM_API_TOKEN: if secrets.ALARM_API_TOKEN and auth_token != 'Bearer ' + secrets.ALARM_API_TOKEN:
raise exceptions.PermissionDenied() raise exceptions.PermissionDenied()
try: try:
@ -1516,7 +1516,7 @@ class ProtocoinViewSet(Base):
try: try:
with transaction.atomic(): with transaction.atomic():
auth_token = request.META.get('HTTP_AUTHORIZATION', '') auth_token = request.META.get('HTTP_AUTHORIZATION', '')
if secrets.VEND_API_TOKEN and auth_token != 'Bearer ' + secrets.PRINTER_API_TOKEN: if secrets.PRINTER_API_TOKEN and auth_token != 'Bearer ' + secrets.PRINTER_API_TOKEN:
raise exceptions.PermissionDenied() raise exceptions.PermissionDenied()
# {'job_name': 'download.png', 'uuid': '6abbad4d-dda3-4954-b4f1-ac77933a0562', 'timestamp': '20230211173624', # {'job_name': 'download.png', 'uuid': '6abbad4d-dda3-4954-b4f1-ac77933a0562', 'timestamp': '20230211173624',