2023-01-18 19:27:41 +01:00
|
|
|
require "uri"
|
|
|
|
require "http-session"
|
|
|
|
|
|
|
|
include CrystalGauntlet
|
|
|
|
|
2023-05-23 10:46:31 +02:00
|
|
|
CrystalGauntlet.template_endpoints[{
|
|
|
|
name: "logout",
|
|
|
|
path: "/accounts/logout",
|
|
|
|
methods: ["post"]
|
|
|
|
}] = ->(context : HTTP::Server::Context, params : Hash(String, String?)) {
|
2023-01-18 19:27:41 +01:00
|
|
|
CrystalGauntlet.sessions.delete(context)
|
|
|
|
|
|
|
|
context.response.headers.add("Location", "/")
|
|
|
|
context.response.status = HTTP::Status::SEE_OTHER
|
|
|
|
return
|
|
|
|
}
|