pre registered device unauthorized condition
This commit is contained in:
@@ -48,7 +48,7 @@ class POSDeviceViewSet(viewsets.ModelViewSet):
|
|||||||
|
|
||||||
# activate device
|
# activate device
|
||||||
if device:
|
if device:
|
||||||
if not device.is_activated and not device.pre_registered:
|
if not device.is_activated or not device.pre_registered:
|
||||||
device.is_activated = True
|
device.is_activated = True
|
||||||
device.save()
|
device.save()
|
||||||
|
|
||||||
@@ -68,6 +68,11 @@ class POSDeviceViewSet(viewsets.ModelViewSet):
|
|||||||
"device_identity": device.device_identity,
|
"device_identity": device.device_identity,
|
||||||
"serial": device.serial
|
"serial": device.serial
|
||||||
}, status=status.HTTP_200_OK)
|
}, status=status.HTTP_200_OK)
|
||||||
|
return Response({
|
||||||
|
"message": "device pre registered - unauthorized",
|
||||||
|
"device_identity": device.device_identity,
|
||||||
|
"serial": device.serial
|
||||||
|
}, status=status.HTTP_401_UNAUTHORIZED)
|
||||||
|
|
||||||
pre_device = pos_models.Device.objects.create(
|
pre_device = pos_models.Device.objects.create(
|
||||||
serial=serial,
|
serial=serial,
|
||||||
|
|||||||
Reference in New Issue
Block a user