feat(web_server.py): remove redirect when logged in and trying to access /

This commit is contained in:
2025-06-16 17:48:09 +02:00
parent c41f95497c
commit f3c844929e

View File

@@ -49,7 +49,7 @@ PC_DETAILS = {
"id": "PC7", "id": "PC7",
"status": "offline", "status": "offline",
"last_seen": "2023-10-01 11:00:00", "last_seen": "2023-10-01 11:00:00",
} },
} }
@@ -79,12 +79,9 @@ def load_user(user_id: str) -> User | None:
@app.route("/") @app.route("/")
def index() -> flask.Response | str: def index() -> flask.Response | str:
"""Renders the index page with a link to the login page.""" """Renders the index page with a link to the login page."""
if flask_login.current_user.is_authenticated: return flask.render_template(
return flask.redirect(flask.url_for("panel")) "index.html", logged=flask_login.current_user.is_authenticated
else: )
return flask.render_template(
"index.html", logged=False, login_url=flask.url_for("login")
)
@app.route("/login", methods=["GET", "POST"]) @app.route("/login", methods=["GET", "POST"])