code: def setup_auth(app):
      if not global_state.get_auth_settings()["active"]:
          return
  
      @app.route("/login", methods=["GET", "POST"])
      def login():
          if request.method == "POST":
              username, password = (
                  request.form.get(p) for p in ["username", "password"]
              )
              if not authenticate(username, password):
                  return render_template(
                      "dtale/login.html",
                      error="Invalid credentials!",
                      page="login",
                  )
              session["logged_in"] = True
              session["username"] = request.form["username"]
              return redirect(session.get("next") or "/")
          return render_template("dtale/login.html", page="login")
  
      @app.route("/logout")
      def logout():
          session.clear()
          return redirect(url_for("login"))
  
imports: from flask import redirect, render_template, request, session, url_for
  from functools import wraps
  import dtale.global_state
label_desc: Use image node_id 1 for calling a global function with example usage: setup_auth(app) and returns: render_template, redirect, redirect, render_template