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()
|
||||||
|
|
||||||
@@ -63,11 +63,16 @@ class POSDeviceViewSet(viewsets.ModelViewSet):
|
|||||||
latitude=headers_data['device-lot'],
|
latitude=headers_data['device-lot'],
|
||||||
longitude=headers_data['device-lng'],
|
longitude=headers_data['device-lng'],
|
||||||
)
|
)
|
||||||
|
return Response({
|
||||||
|
"message": "login success - session activated",
|
||||||
|
"device_identity": device.device_identity,
|
||||||
|
"serial": device.serial
|
||||||
|
}, status=status.HTTP_200_OK)
|
||||||
return Response({
|
return Response({
|
||||||
"message": "login success - session activated",
|
"message": "device pre registered - unauthorized",
|
||||||
"device_identity": device.device_identity,
|
"device_identity": device.device_identity,
|
||||||
"serial": device.serial
|
"serial": device.serial
|
||||||
}, status=status.HTTP_200_OK)
|
}, 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