예제 #1
0
    def post(self, request):
        if not request.user.is_authenticated():
            return Response(status=400)

        # Must use the real request object that Django knows about
        login(request._request, request.user)

        # TODO: make internal request to UserDetailsEndpoint
        from sentry.api.endpoints.user_details import UserDetailsEndpoint
        endpoint = UserDetailsEndpoint()
        response = endpoint.get(request, user_id=request.user.id)
        return response
예제 #2
0
    def post(self, request):
        """
        Authenticate a user

        Authenticate a user using the provided credentials.

            curl -X {method} -u PUBLIC_KEY:SECRET_KEY {path}

        """
        if not request.user.is_authenticated():
            return Response(status=400)

        # Must use the real request object that Django knows about
        login(request._request, request.user)

        # TODO: make internal request to UserDetailsEndpoint
        from sentry.api.endpoints.user_details import UserDetailsEndpoint
        endpoint = UserDetailsEndpoint()
        response = endpoint.get(request, user_id=request.user.id)
        return response