func (h *handler) handleLogout(w http.ResponseWriter, r *http.Request, s *session.Session) (interface{}, error) { if s != nil { s.Del("coder") if err := s.Save(); err != nil { return nil, err } } return nil, nil }
func (h *handler) handleLogin(w http.ResponseWriter, r *http.Request, s *session.Session) (interface{}, error) { handle := r.FormValue("handle") c, err := h.dbMgr.FetchCoder(handle) if err != nil || c == nil { return nil, err } passwd := r.FormValue("passwd") if !c.CheckPasswd(passwd) { return nil, nil } s.Set("coder", c) if err := s.Save(); err != nil { return nil, err } return c, nil }