feat(webui): bootstrap session handling and login process

This commit is contained in:
Julien Dessaux 2025-01-06 00:41:32 +01:00
parent 63e2b1b09d
commit 6e069484cb
Signed by: adyxax
GPG key ID: F92E51B86E07177E
18 changed files with 447 additions and 1 deletions

20
pkg/webui/html/base.html Normal file
View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/static/favicon.svg">
<link rel="stylesheet" href="/static/main.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
<title>tfstated</title>
</head>
<body>
<header>
</header>
<main class="container">
{{ template "main" . }}
</main>
<footer>
</footer>
</body>
</html>

View file

@ -0,0 +1,6 @@
{{ define "main" }}
<article>
<h1>{{ .Status }} - {{ .StatusText }}</h1>
<p>{{ .Err }}</p>
</article>
{{ end }}

View file

@ -0,0 +1,3 @@
{{ define "main" }}
<h1>TODO</h1>
{{ end }}

29
pkg/webui/html/login.html Normal file
View file

@ -0,0 +1,29 @@
{{ define "main" }}
{{ if .Forbidden }}
<article>
<p class="error-message">Invalid username or password</p>
</article>
{{ end }}
<form action="/login" method="post">
<fieldset>
<label>
Username
<input type="text"
placeholder="Username"
name="username"
value="{{ .Username }}"
{{ if .Forbidden }}aria-invalid="true"{{ end }}
required>
</label>
<label>
Password
<input type="password"
placeholder="Password"
name="password"
{{ if .Forbidden }}aria-invalid="true"{{ end }}
required>
</label>
</fieldset>
<button type="submit" value="login">Login</button>
</form>
{{ end }}