Merge pull request #845 from steindornatorinn/cookie-fix2
This should fix the cookie domain issues
Cette révision appartient à :
révision
e3c8e6a3b1
1 fichiers modifiés avec 6 ajouts et 0 suppressions
|
@ -22,6 +22,10 @@ const (
|
|||
CookieName = "session"
|
||||
// UserContextKey : key for user context
|
||||
UserContextKey = "nyaapantsu.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
|
||||
|
@ -58,6 +62,7 @@ func EncodeCookie(userID uint) (string, error) {
|
|||
func ClearCookie(w http.ResponseWriter) (int, error) {
|
||||
cookie := &http.Cookie{
|
||||
Name: CookieName,
|
||||
Domain: DomainName,
|
||||
Value: "",
|
||||
Path: "/",
|
||||
HttpOnly: true,
|
||||
|
@ -100,6 +105,7 @@ func SetCookieHandler(w http.ResponseWriter, r *http.Request, email string, pass
|
|||
}
|
||||
cookie := &http.Cookie{
|
||||
Name: CookieName,
|
||||
Domain: DomainName,
|
||||
Value: encoded,
|
||||
Path: "/",
|
||||
HttpOnly: true,
|
||||
|
|
Référencer dans un nouveau ticket