pre registered device unauthorized condition
This commit is contained in:
@@ -48,7 +48,7 @@ class POSDeviceViewSet(viewsets.ModelViewSet):
|
||||
|
||||
# activate 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.save()
|
||||
|
||||
@@ -63,11 +63,16 @@ class POSDeviceViewSet(viewsets.ModelViewSet):
|
||||
latitude=headers_data['device-lot'],
|
||||
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({
|
||||
"message": "login success - session activated",
|
||||
"message": "device pre registered - unauthorized",
|
||||
"device_identity": device.device_identity,
|
||||
"serial": device.serial
|
||||
}, status=status.HTTP_200_OK)
|
||||
}, status=status.HTTP_401_UNAUTHORIZED)
|
||||
|
||||
pre_device = pos_models.Device.objects.create(
|
||||
serial=serial,
|
||||
|
||||
Reference in New Issue
Block a user