4 Commits

3 changed files with 12 additions and 13 deletions

View File

@@ -15,7 +15,7 @@
<main> <main>
<div class="button-container"> <div class="button-container">
<p><a href="{{ url_for('panel') }}" class="link">Back to Panel</a></p> <p><a href="{{ url_for('panel') }}" class="link">Back to Panel</a></p>
<h2>Details for PC ID: {{ pc.id }}</h2> <h2>{{ pc.id }}</h2>
<p><a href="{{ url_for('stream', pc_id=pc.id) }}" class="link">View Stream</a></p> <p><a href="{{ url_for('stream', pc_id=pc.id) }}" class="link">View Stream</a></p>
</div> </div>
<table class="center-table details-table"> <table class="center-table details-table">

View File

@@ -11,7 +11,7 @@
<header> <header>
<h1><a href="{{ url_for('index') }}">judas</a></h1> <h1><a href="{{ url_for('index') }}">judas</a></h1>
{% if logged %} {% if logged %}
<p>Welcome, {{ username }}! <a href="{{ url_for('logout') }}">Logout</a></p> <p><a class="button" href="{{ url_for('logout') }}">Logout</a></p>
{% else %} {% else %}
<p><a class="button" href="{{ url_for('login') }}">Login</a></p> <p><a class="button" href="{{ url_for('login') }}">Login</a></p>
{% endif %} {% endif %}
@@ -22,10 +22,12 @@
<h2 id="typing-text" style="font-size: 3rem;">judas</h2> <h2 id="typing-text" style="font-size: 3rem;">judas</h2>
<p>a remote PC fleet management system</p> <p>a remote PC fleet management system</p>
</div> </div>
<div> <p style="color: #bf616a;"><strong>Notice:</strong> Please use this system responsibly and in accordance with all applicable laws and organizational policies.</p>
<p style="color: #bf616a;"><strong>Notice:</strong> Please use this system responsibly and in accordance with all applicable laws and organizational policies.</p> {% if logged %}
<p>Please <a href="{{ url_for('login')}}" class="link">log in</a> to manage your remote PCs.</p> <p><a class="button" href="{{ url_for('panel') }}">Go to panel</a></p>
</div> {% else %}
<p>Please <a href="{{ url_for('login')}}" class="link">log in</a> to manage your remote PCs.</p>
{% endif %}
</main> </main>
</div> </div>
<script> <script>

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"])