diff --git a/public/style.css b/public/style.css index 524461c..ef91c94 100644 --- a/public/style.css +++ b/public/style.css @@ -39,6 +39,10 @@ body { margin: 2rem; } +button, input { + font-family: inherit; +} + a { color: var(--accent-color); transition: 0.1s color; @@ -166,4 +170,19 @@ pre { flex-direction: row; gap: 0.5em; align-items: center; +} + +.inline-post { + display: inline; +} +.inline-post-button { + display: inline; + background: none; + outline: none; + border: none; + color: inherit; + font-size: inherit; + font-weight: inherit; + text-decoration: underline; + cursor: pointer; } \ No newline at end of file diff --git a/public/template/account_management.ecr b/public/template/account_management.ecr index d5aab45..82d1cb2 100644 --- a/public/template/account_management.ecr +++ b/public/template/account_management.ecr @@ -119,7 +119,12 @@
- Settings · Log out + Settings · +
+ +
diff --git a/src/template_endpoints/logout.cr b/src/template_endpoints/logout.cr new file mode 100644 index 0000000..51b88ee --- /dev/null +++ b/src/template_endpoints/logout.cr @@ -0,0 +1,17 @@ +require "uri" +require "http-session" + +include CrystalGauntlet + +CrystalGauntlet.template_endpoints["/accounts/logout"] = ->(context : HTTP::Server::Context) { + if context.request.method != "POST" + context.response.respond_with_status 405 + return + end + + CrystalGauntlet.sessions.delete(context) + + context.response.headers.add("Location", "/") + context.response.status = HTTP::Status::SEE_OTHER + return +}