def redirect_login()

in src/redash_stmo/handlers/authentication/remote_user_auth.py [0:0]


def redirect_login():
    """Automatically redirects from /login to /remote_user/login.
    """
    login_path = get_login_url(external=False, next=None)
    if (
        settings.REMOTE_USER_LOGIN_ENABLED
        and not request.is_xhr
        and request.path.startswith(login_path)
    ):
        org_slug = current_org.slug
        index_url = url_for("redash.index", org_slug=org_slug)
        unsafe_next_path = request.args.get("next", index_url)
        next_path = get_next_path(unsafe_next_path)
        remote_login_url = url_for(
            "remote_user_auth.login", next=next_path, org_slug=org_slug
        )
        return redirect(remote_login_url)