Add logout link in sidebar

This commit is contained in:
William Brawner 2024-04-21 10:02:23 -06:00
parent 955ee0f126
commit 22061e3f4a
2 changed files with 13 additions and 6 deletions

View file

@ -37,6 +37,14 @@ fun Application.userWebRoutes(userService: UserService) {
} }
} }
} }
route("/logout") {
post {
call.sessions.clear<CookieSession>()
call.respondRedirect("/")
}
}
route("/register") { route("/register") {
get { get {
call.respond(MustacheContent("register.mustache", RegisterPage())) call.respond(MustacheContent("register.mustache", RegisterPage()))

View file

@ -40,13 +40,12 @@
About Twigs About Twigs
</a> </a>
</li> </li>
TODO: Implement logout
<li class="list-item">
<a href="/logout">
Logout
</a>
</li>
--> -->
<li class="list-item">
<form action="/logout" method="post">
<input type="submit" value="Logout"/>
</form>
</li>
<li class="list-item"> <li class="list-item">
<a href="https://github.com/wbrawner/twigs"> <a href="https://github.com/wbrawner/twigs">
Source Code Source Code