MCPcopy
hub / github.com/writefreely/writefreely / InitSession

Method InitSession

session.go:36–52  ·  view source on GitHub ↗

InitSession creates the cookie store. It depends on the keychain already being loaded.

()

Source from the content-addressed store, hash-verified

34// InitSession creates the cookie store. It depends on the keychain already
35// being loaded.
36func (app *App) InitSession() {
37 // Register complex data types we'll be storing in cookies
38 gob.Register(&User{})
39
40 // Create the cookie store
41 store := sessions.NewCookieStore(app.keys.CookieAuthKey, app.keys.CookieKey)
42 store.Options = &sessions.Options{
43 Path: "/",
44 MaxAge: sessionLength,
45 HttpOnly: true,
46 Secure: strings.HasPrefix(app.cfg.App.Host, "https://"),
47 }
48 if store.Options.Secure {
49 store.Options.SameSite = http.SameSiteNoneMode
50 }
51 app.sessionStore = store
52}
53
54func getSessionFlashes(app *App, w http.ResponseWriter, r *http.Request, session *sessions.Session) ([]string, error) {
55 var err error

Callers 1

InitializeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected