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