MCPcopy
hub / github.com/writefreely/writefreely / getUserAndSession

Function getUserAndSession

session.go:92–105  ·  view source on GitHub ↗
(app *App, r *http.Request)

Source from the content-addressed store, hash-verified

90}
91
92func getUserAndSession(app *App, r *http.Request) (*User, *sessions.Session) {
93 session, err := app.sessionStore.Get(r, cookieName)
94 if err == nil {
95 // Got the currently logged-in user
96 val := session.Values[cookieUserVal]
97 var u = &User{}
98 var ok bool
99 if u, ok = val.(*User); ok {
100 return u, session
101 }
102 }
103
104 return nil, nil
105}
106
107func getUserSession(app *App, r *http.Request) *User {
108 u, _ := getUserAndSession(app, r)

Callers 3

viewOauthInitMethod · 0.85
updateSettingsFunction · 0.85
getUserSessionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected