def METHOD_NAME(request):
    if request.method == 'POST':
        port = int(request.POST['port'])
        user = str(request.POST['username'])
        password = str(request.POST['password'])
        zone = str(request.POST['zone'])
        host = str(request.POST['host'])
        datastore = "/%s/home/%s" % (zone, user)
        response_data = {}
        irods_sess = iRODSSession(user=user, password=password, zone=zone, host=host, port=port)
        try:
            irods_sess.collections.get(datastore)
        except CollectionDoesNotExist:
            response_data['irods_loggedin'] = False
            response_data['login_message'] = 'iRODS login failed'
            response_data['error'] = "iRODS collection does not exist"
            irods_sess.cleanup()
            return JsonResponse(response_data, status=status.HTTP_400_BAD_REQUEST)
        else:
            response_data['user'] = user
            response_data['password'] = password
            response_data['port'] = port
            response_data['host'] = host
            response_data['zone'] = zone
            response_data['datastore'] = datastore
            response_data['irods_loggedin'] = True
            irods_sess.cleanup()
            return JsonResponse(response_data, status=status.HTTP_200_OK)
    else:
        return JsonResponse({"error": "Not POST request"}, status=status.HTTP_400_BAD_REQUEST)