nice
This commit is contained in:
parent
a2fd47369d
commit
4b40d179b8
@ -37,10 +37,12 @@ class TimeEntryScanView(APIView):
|
|||||||
permission_classes = [IsAuthenticated]
|
permission_classes = [IsAuthenticated]
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
code = request.data.get('code')
|
code = str(request.data.get('code') or '').strip()
|
||||||
if code == config('SECRET_POINTAGE_ENTER', default=''):
|
enter_code = config('SECRET_POINTAGE_ENTER', default='').strip()
|
||||||
|
exit_code = config('SECRET_POINTAGE_EXIT', default='').strip()
|
||||||
|
if code == enter_code:
|
||||||
action = 'enter'
|
action = 'enter'
|
||||||
elif code == config('SECRET_POINTAGE_EXIT', default=''):
|
elif code == exit_code:
|
||||||
action = 'exit'
|
action = 'exit'
|
||||||
else:
|
else:
|
||||||
return Response({'error': 'QR code de pointage invalide.'}, status=status.HTTP_400_BAD_REQUEST)
|
return Response({'error': 'QR code de pointage invalide.'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user