23 lines
601 B
HTML
23 lines
601 B
HTML
{{ define "nav" }}
|
|
<nav>
|
|
<div>
|
|
<a href="/">Home</a>
|
|
<a href="/users">Users</a>
|
|
</div>
|
|
<div>
|
|
{{ if .IsAuthenticated }}
|
|
{{ with .CurrentUser }}
|
|
Welcome, {{ .Username }}
|
|
{{ 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 }}
|