23 lines
631 B
HTML
23 lines
631 B
HTML
{{ define "nav" }}
|
|
<nav>
|
|
<div>
|
|
<a href="/">Home</a>
|
|
<a href="/users">Users</a>
|
|
</div>
|
|
<div>
|
|
{{ if .IsAuthenticated }}
|
|
{{ with .User }}
|
|
<a href="/users/{{ .User.ShortId }}">{{ .User.Username }}</a>
|
|
{{ end }}
|
|
<form action="/users/logout" method="post">
|
|
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
|
<button>Logout</button>
|
|
</form>
|
|
{{ else }}
|
|
<a href="/users/register">Register</a>
|
|
<a href="/users/login">Login</a>
|
|
{{ end }}
|
|
</div>
|
|
</nav>
|
|
{{ end }}
|