Navbar logout as a POST form instead of a GET link
A GET logout can be triggered from any foreign page (img/link) and by link prefetchers. LogoutPath now renders <form method="post"> with a submit button styled like the former link; consumers register the route as POST only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b6a6298353
commit
d0e49b2365
4 files changed
+32
-6
No files matched your search
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
{{if .Username}}<span class="navbar-subtitle">{{.Username}}</span>{{end}}
|
||||
{{if .LogoutPath}}<a href="{{.BasePath}}{{.LogoutPath}}" class="btn btn-outline-secondary btn-sm">Logout</a>{{end}}
|
||||
{{if .LogoutPath}}<form method="post" action="{{.BasePath}}{{.LogoutPath}}" class="d-inline m-0"><button type="submit" class="btn btn-outline-secondary btn-sm">Logout</button></form>{{end}}
|
||||
{{.NavbarRightExtra}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user