Use redis to store the sessions

This commit is contained in:
2024-07-29 21:54:37 +02:00
parent 52c3679158
commit 5d225f0186
5 changed files with 30 additions and 7 deletions

View File

@ -139,8 +139,6 @@ func (m *Repository) PostMakeReservation(w http.ResponseWriter, r *http.Request)
reservation.Email = form.Get("email")
reservation.Phone = form.Get("phone")
// TODO: Should I check the validity of reservation.StartDate / EndDate?
if !form.Valid() {
data := make(map[string]interface{})
data["reservation"] = reservation
@ -508,7 +506,6 @@ func (m *Repository) PostShowLogin(w http.ResponseWriter, r *http.Request) {
// Logout logs a user out
func (m *Repository) Logout(w http.ResponseWriter, r *http.Request) {
// TODO Use Redis to store the session. Check the documentation of scs package
m.App.Session.Destroy(r.Context())
m.App.Session.RenewToken(r.Context())
http.Redirect(w, r, "/user/login", http.StatusSeeOther)