Skip to content
This repository was archived by the owner on Oct 13, 2020. It is now read-only.
This repository was archived by the owner on Oct 13, 2020. It is now read-only.

500 error on demo site #2

@itbabu

Description

@itbabu

Hi
I was playing with your demo.

If I do a POST directly to the auth endpoint I get a 500.

http://54.186.139.158/api/auth/

A check before call login() should be enough.

class AuthView(APIView):
    authentication_classes = (authenticators.QuietBasicAuthentication,)

    def post(self, request, *args, **kwargs):
        if request.user.is_anonymous():
            return HttpResponseBadRequest()
        login(request, request.user)
        return Response(serializers.UserSerializer(request.user).data)

I don't see how a not "malicious" user should get to that point and be anonymous.
If I'm wrong... something different than a 400 error should be given to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions