add logout route
This commit is contained in:
parent
36624b675d
commit
07ebc06b32
2 changed files with 6 additions and 0 deletions
|
|
@ -30,6 +30,11 @@ func (h *authHandler) PasswordPage(w http.ResponseWriter, r *http.Request) {
|
||||||
ui.Render(w, r, pages.AuthPassword(""))
|
ui.Render(w, r, pages.AuthPassword(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *authHandler) Logout(w http.ResponseWriter, r *http.Request) {
|
||||||
|
h.authService.ClearJWTCookie(w)
|
||||||
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *authHandler) SendMagicLink(w http.ResponseWriter, r *http.Request) {
|
func (h *authHandler) SendMagicLink(w http.ResponseWriter, r *http.Request) {
|
||||||
email := strings.TrimSpace(r.FormValue("email"))
|
email := strings.TrimSpace(r.FormValue("email"))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ func SetupRoutes(a *app.App) http.Handler {
|
||||||
|
|
||||||
// Auth Actions
|
// Auth Actions
|
||||||
mux.HandleFunc("POST /auth/magic-link", authRateLimiter(middleware.RequireGuest(auth.SendMagicLink)))
|
mux.HandleFunc("POST /auth/magic-link", authRateLimiter(middleware.RequireGuest(auth.SendMagicLink)))
|
||||||
|
mux.HandleFunc("POST /auth/logout", authRateLimiter(auth.Logout))
|
||||||
|
|
||||||
// ====================================================================================
|
// ====================================================================================
|
||||||
// PRIVATE ROUTES
|
// PRIVATE ROUTES
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue