Respond with a JSON struct containing info about the current login session
(session *auth.LoginSession)
| 315 | |
| 316 | // Respond with a JSON struct containing info about the current login session |
| 317 | func (h *handler) respondWithSessionInfoForSession(session *auth.LoginSession) error { |
| 318 | |
| 319 | user, err := h.db.Authenticator(h.ctx()).GetUser(session.Username) |
| 320 | |
| 321 | // let the empty user case succeed |
| 322 | if err != nil { |
| 323 | return err |
| 324 | } |
| 325 | |
| 326 | response := h.formatSessionResponse(user, "") |
| 327 | if response != nil { |
| 328 | h.writeJSON(response) |
| 329 | } |
| 330 | return nil |
| 331 | } |
| 332 | |
| 333 | // Formats session response similar to what is returned by CouchDB |
| 334 | func (h *handler) formatSessionResponse(user auth.User, oneTimeSessionID string) db.Body { |
no test coverage detected