update cookie settings
This commit is contained in:
@@ -76,6 +76,13 @@ func (wc *WebController) newTemplateData(w http.ResponseWriter, r *http.Request)
|
|||||||
Expires: time.Unix(0, 0),
|
Expires: time.Unix(0, 0),
|
||||||
Domain: wc.sessionCookieDomain,
|
Domain: wc.sessionCookieDomain,
|
||||||
})
|
})
|
||||||
|
http.SetCookie(w, &http.Cookie{
|
||||||
|
Name: "pd_auth_key",
|
||||||
|
Value: "",
|
||||||
|
Path: "/",
|
||||||
|
Expires: time.Unix(0, 0),
|
||||||
|
Domain: ".pixeldrain.com",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
@@ -172,6 +172,8 @@ func (wc *WebController) loginForm(td *TemplateData, r *http.Request) (f Form) {
|
|||||||
// Request was a success
|
// Request was a success
|
||||||
f.SubmitSuccess = true
|
f.SubmitSuccess = true
|
||||||
f.SubmitMessages = []template.HTML{"Success!"}
|
f.SubmitMessages = []template.HTML{"Success!"}
|
||||||
|
|
||||||
|
// Set the autentication cookie
|
||||||
f.Extra.SetCookie = &http.Cookie{
|
f.Extra.SetCookie = &http.Cookie{
|
||||||
Name: "pd_auth_key",
|
Name: "pd_auth_key",
|
||||||
Value: loginResp.APIKey,
|
Value: loginResp.APIKey,
|
||||||
|
@@ -183,6 +183,7 @@ func (wc *WebController) serveForm(
|
|||||||
|
|
||||||
// Execute the extra actions if any
|
// Execute the extra actions if any
|
||||||
if td.Form.Extra.SetCookie != nil {
|
if td.Form.Extra.SetCookie != nil {
|
||||||
|
w.Header().Del("Set-Cookie")
|
||||||
http.SetCookie(w, td.Form.Extra.SetCookie)
|
http.SetCookie(w, td.Form.Extra.SetCookie)
|
||||||
}
|
}
|
||||||
if td.Form.Extra.RedirectTo != "" {
|
if td.Form.Extra.RedirectTo != "" {
|
||||||
|
Reference in New Issue
Block a user