This should fix the cookie domain issues
Cette révision appartient à :
Parent
d286832090
révision
2e2e5608d4
1 fichiers modifiés avec 4 ajouts et 0 suppressions
|
@ -22,6 +22,8 @@ const (
|
||||||
CookieName = "session"
|
CookieName = "session"
|
||||||
// UserContextKey : key for user context
|
// UserContextKey : key for user context
|
||||||
UserContextKey = "user"
|
UserContextKey = "user"
|
||||||
|
// Domain name : The host domain so these can be shared across sukebei and nyaa
|
||||||
|
DomainName = "pantsu.cat"
|
||||||
)
|
)
|
||||||
|
|
||||||
// If you want to keep login cookies between restarts you need to make these permanent
|
// If you want to keep login cookies between restarts you need to make these permanent
|
||||||
|
@ -58,6 +60,7 @@ func EncodeCookie(userID uint) (string, error) {
|
||||||
func ClearCookie(w http.ResponseWriter) (int, error) {
|
func ClearCookie(w http.ResponseWriter) (int, error) {
|
||||||
cookie := &http.Cookie{
|
cookie := &http.Cookie{
|
||||||
Name: CookieName,
|
Name: CookieName,
|
||||||
|
Domain: DomainName,
|
||||||
Value: "",
|
Value: "",
|
||||||
Path: "/",
|
Path: "/",
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
|
@ -100,6 +103,7 @@ func SetCookieHandler(w http.ResponseWriter, r *http.Request, email string, pass
|
||||||
}
|
}
|
||||||
cookie := &http.Cookie{
|
cookie := &http.Cookie{
|
||||||
Name: CookieName,
|
Name: CookieName,
|
||||||
|
Domain: DomainName,
|
||||||
Value: encoded,
|
Value: encoded,
|
||||||
Path: "/",
|
Path: "/",
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
|
|
Référencer dans un nouveau ticket