mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 21:59:40 +00:00
analytics section api, users counts, new signup count, task report
This commit is contained in:
@ -154,10 +154,9 @@ class AdminLoginSerializer(serializers.ModelSerializer):
|
||||
user = User.objects.filter(email__iexact=attrs['email'], is_superuser=True
|
||||
).only('id', 'first_name', 'last_name', 'email', 'is_superuser').first()
|
||||
|
||||
if not user:
|
||||
raise serializers.ValidationError({'details': ERROR_CODE['2002']})
|
||||
elif not user.check_password(attrs['password']):
|
||||
if not user or not user.check_password(attrs['password']):
|
||||
raise serializers.ValidationError({'details': ERROR_CODE['2002']})
|
||||
|
||||
self.context.update({'user': user})
|
||||
return attrs
|
||||
|
||||
|
@ -334,10 +334,9 @@ class UserLogin(viewsets.ViewSet):
|
||||
user = User.objects.filter(email__iexact=email, is_superuser=True
|
||||
).only('id', 'first_name', 'last_name', 'email', 'is_superuser').first()
|
||||
|
||||
if not user:
|
||||
return custom_error_response(ERROR_CODE["2002"], response_status=status.HTTP_400_BAD_REQUEST)
|
||||
elif not user.check_password(password):
|
||||
if not user or not user.check_password(password):
|
||||
return custom_error_response(ERROR_CODE["2002"], response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
serializer = SuperUserSerializer(user)
|
||||
return custom_response(SUCCESS_CODE['3003'], serializer.data, response_status=status.HTTP_200_OK)
|
||||
|
||||
|
Reference in New Issue
Block a user