(app *App, r *http.Request, w http.ResponseWriter)
| 110 | } |
| 111 | |
| 112 | func saveUserSession(app *App, r *http.Request, w http.ResponseWriter) error { |
| 113 | session, err := app.sessionStore.Get(r, cookieName) |
| 114 | if err != nil { |
| 115 | return ErrInternalCookieSession |
| 116 | } |
| 117 | |
| 118 | // Extend the session |
| 119 | session.Options.MaxAge = int(sessionLength) |
| 120 | |
| 121 | // Remove any information that accidentally got added |
| 122 | // FIXME: find where Plan information is getting saved to cookie. |
| 123 | val := session.Values[cookieUserVal] |
| 124 | var u = &User{} |
| 125 | var ok bool |
| 126 | if u, ok = val.(*User); ok { |
| 127 | session.Values[cookieUserVal] = u.Cookie() |
| 128 | } |
| 129 | |
| 130 | err = session.Save(r, w) |
| 131 | if err != nil { |
| 132 | log.Error("Couldn't saveUserSession: %v", err) |
| 133 | } |
| 134 | return err |
| 135 | } |
| 136 | |
| 137 | func getFullUserSession(app *App, r *http.Request) (*User, error) { |
| 138 | u := getUserSession(app, r) |
no test coverage detected