def METHOD_NAME(request: 'pyramid.request.Request'):
    """Get the URL that the user should be redirected to after logging in.
    Args:
        request (pyramid.request.Request): the current request.
    Returns:
        HTTPFound: An HTTP 302 response redirecting to the right URL.
    """
    came_from = request.session.get('came_from', request.route_path("home"))
    request.session.pop('came_from', None)
    # Mitigate "Covert Redirect"
    if not came_from.startswith(request.host_url):
        came_from = request.route_path("home")
    # Don't redirect endlessly to the login view
    if came_from.startswith(request.route_url('login')):
        came_from = request.route_path("home")
    return HTTPFound(location=came_from)