Stack of changes to get gin, scs, nosurf running.

This commit is contained in:
2025-10-28 11:56:42 +00:00
parent 07117ba35e
commit 86be6479f1
65 changed files with 1890 additions and 1503 deletions

View File

@@ -1,7 +1,7 @@
{{ define "content" }}
<h2>Login</h2>
<form method="POST" action="/account/login" class="form">
{{ .CSRFField }}
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<div class="mb-3">
<label for="username">Username:</label>
@@ -20,4 +20,4 @@
<button type="submit" class="btn btn-primary">Login</button>
</form>
{{ end }}
{{ end }}

View File

@@ -1,9 +1,43 @@
{{ define "content" }}
<h2>Sign Up</h2>
<form method="POST" action="/account/signup">
{{ .csrfField }}
<label>Username: <input type="text" name="username" required></label><br>
<label>Password: <input type="password" name="password" required></label><br>
<button type="submit">Sign Up</button>
<h2>Create your account</h2>
{{ if .Flash }}<div class="flash">{{ .Flash }}</div>{{ end }}
<form method="POST" action="/account/signup" class="form">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<div class="mb-3">
<label for="username">Username</label>
<input type="text" name="username" id="username" required class="form-control"
value="{{ with .Form }}{{ .Username }}{{ end }}">
{{ with .Errors }}{{ with index . "username" }}<div class="error">{{ . }}</div>{{ end }}{{ end }}
</div>
<div class="mb-3">
<label for="email">Email</label>
<input type="email" name="email" id="email" required class="form-control"
value="{{ with .Form }}{{ .Email }}{{ end }}">
{{ with .Errors }}{{ with index . "email" }}<div class="error">{{ . }}</div>{{ end }}{{ end }}
</div>
<div class="mb-3">
<label for="password">Password</label>
<input type="password" name="password" id="password" required class="form-control">
{{ with .Errors }}{{ with index . "password" }}<div class="error">{{ . }}</div>{{ end }}{{ end }}
</div>
<div class="mb-3">
<label for="password_confirm">Confirm Password</label>
<input type="password" name="password_confirm" id="password_confirm" required class="form-control">
{{ with .Errors }}{{ with index . "password_confirm" }}<div class="error">{{ . }}</div>{{ end }}{{ end }}
</div>
<div class="form-check mb-3">
<input type="checkbox" name="accept_terms" id="accept_terms" class="form-check-input"
{{ with .Form }}{{ if .AcceptTerms }}checked{{ end }}{{ end }}>
<label for="accept_terms" class="form-check-label">I accept the terms</label>
{{ with .Errors }}{{ with index . "accept_terms" }}<div class="error">{{ . }}</div>{{ end }}{{ end }}
</div>
<button type="submit" class="btn btn-primary">Create account</button>
</form>
{{ end }}
{{ end }}

View File

@@ -1,7 +1,7 @@
{{ define "topbar" }}
<nav class="navbar navbar-expand-lg navbar-light bg-light px-3">
<a class="navbar-brand d-flex align-items-center" href="/">
<img src="/static/img/logo.png" alt="Logo" height="30" class="me-2">
<img src="/static/imgs/logo.png" alt="Logo" height="30" class="me-2">
<span>SynLotto</span>
</a>
<div class="ms-auto d-flex align-items-center gap-3">
@@ -122,6 +122,7 @@
</ul>
</div>
{{ else }}
<a class="btn btn-outline-secondary btn-sm" href="/account/signup">Sign Up</a>
<a class="btn btn-outline-primary btn-sm" href="/account/login">Login</a>
{{ end }}
</div>