21 lines
509 B
Go
21 lines
509 B
Go
package auth
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func (auth *AuthMiddleware) LogoutPost(w http.ResponseWriter, r *http.Request) {
|
|
session, err := auth.Store.Get(r, "lishwist_user")
|
|
if err != nil {
|
|
http.Error(w, "Something went wrong. Error code: Iroh", http.StatusInternalServerError)
|
|
return
|
|
}
|
|
session.Values = nil
|
|
if err := session.Save(r, w); err != nil {
|
|
http.Error(w, "Something went wrong. Error code: Azula", http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
|
}
|