def post(self, request):
        
        try:
            user = User.objects.get(email=request.POST['email'])
            user = authenticate(username=user.username, password=request.POST['password'])
          
            if user is not None:
                if user.is_active:
                    login(request, user)
                    response = Response(status.HTTP_200_OK,
                                        {"msg": MESSAGES.get('user_authenticated', "")})
                else:
                    response = Response(status.HTTP_400_BAD_REQUEST,
                                        {"msg": MESSAGES.get('inactive_user', "")})
                    
            else:
                response = Response(status.HTTP_400_BAD_REQUEST,
                                    {"msg": MESSAGES.get('bad_login_pwd', "")})

        except User.DoesNotExist:            
            response = Response(status.HTTP_400_BAD_REQUEST,
                                {"msg": MESSAGES.get('bad_login_pwd', "")})
            
        return self.render(response)
Handle POST requests, managing the user authentication.
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/administration/views/login.py/LoginView.post