Personal Git forge.

Code git clone ssh://git.poy.ooo:6969/~poyo/farga ZIP
lib/cookies.go / 592B #bdf0aea7
Raw
package libimport (	"net/http"	"time")func DeleteCookie(w http.ResponseWriter, name string) {	cookie := &http.Cookie{		Name:    name,		Value:   "",		Expires: time.Unix(0, 0), // Past date / delete		MaxAge:  -1,		Path:    "/",	}	http.SetCookie(w, cookie)}func SetCookie(w http.ResponseWriter, name string, value string) {	http.SetCookie(w, &http.Cookie{		Name:     name,		Expires:  time.Now().AddDate(0, 0, SessionDurationDays),		HttpOnly: true,		Secure:   true, // send cookie only over HTTPS		SameSite: http.SameSiteLaxMode,		Value:    value,		Path:     "/",	})}