add a login and encrypt the .env so people can't get in and still the api key

This commit is contained in:
rainyy21
2026-11-11 17:01:25 -05:00
parent f662e647d7
commit 96e608126b
10 changed files with 422 additions and 72 deletions
+1 -1
View File
@@ -25,6 +25,6 @@
{% endfor %}
</div>
<script src="{{ url_for('static', filename='app.js') }}"></script>
{% block scripts %}<script src="{{ url_for('static', filename='app.js') }}"></script>{% endblock %}
</body>
</html>
+4
View File
@@ -18,6 +18,10 @@
{% endif %}
</div>
<button class="btn primary" data-open="#add-modal" data-focus="#f-name">+ add repo</button>
<form class="logout" method="post" action="{{ url_for('logout') }}">
<input type="hidden" name="csrf" value="{{ csrf_token() }}">
<button class="btn" title="log out {{ session.user }}">log out</button>
</form>
</div>
</header>
+32
View File
@@ -0,0 +1,32 @@
{% extends "base.html" %}
{% block title %}log in · gitops-watcher{% endblock %}
{% block content %}
<main class="login">
<form class="modal" method="post">
<input type="hidden" name="csrf" value="{{ csrf_token() }}">
<div class="modal-head">☂ gitops-watcher</div>
<div class="modal-body">
{% if not configured %}
<div class="login-note">login isn't set up: set WEB_ADMIN_USER and WEB_ADMIN_PASSWORD_HASH in .env and recreate the container</div>
{% endif %}
{% if error %}<div class="login-error" role="alert">{{ error }}</div>{% endif %}
<div class="field">
<label for="l-user">username</label>
<input type="text" id="l-user" name="username" autocomplete="username" autocapitalize="none" spellcheck="false" required autofocus>
</div>
<div class="field">
<label for="l-pass">password</label>
<input type="password" id="l-pass" name="password" autocomplete="current-password" required>
</div>
</div>
<div class="modal-foot">
<button class="btn primary">log in</button>
</div>
</form>
</main>
{% endblock %}
{# app.js drives the dashboard (and reloads it every minute), so it stays off this page #}
{% block scripts %}{% endblock %}