tfstated/pkg/webui/html/login.html
Julien Dessaux 5d7b540718
All checks were successful
main / main (push) Successful in 1m59s
main / deploy (push) Has been skipped
main / publish (push) Has been skipped
feat(webui): add csrf tokens to all forms processing code
Closes #60
2025-05-01 08:39:20 +02:00

32 lines
1.3 KiB
HTML

{{ define "main" }}
<div style="display: grid;">
<form action="/login" method="post" style="align-self:center; justify-self: center;">
<input name="csrf_token" type="hidden" value="{{ .Page.Session.Data.CsrfToken }}">
<fieldset style="align-items:center; display:flex; flex-direction:column; gap:8px;">
<legend>Login</legend>
<div style="align-items:center; display:flex; flex-direction:row; gap:8px;">
<label for="username">Username</label>
<input autofocus
{{ if .Forbidden }}class="error"{{ end }}
id="username"
name="username"
type="text"
value="{{ .Username }}"
required>
</div>
<div style="align-items:center; display:flex; flex-direction:row; gap:8px;">
<label for="password">Password</label>
<input {{ if .Forbidden }}class="error"{{ end }}
id="password"
name="password"
type="password"
required>
</div>
{{ if .Forbidden }}<span class="error">Invalid username or password</span>{{ end }}
<div style="align-self:stretch; display:flex; justify-content:flex-end;">
<button class="primary" type="submit" value="login">Login</button>
</div>
</fieldset>
</form>
</div>
{{ end }}