Exemplo n.º 1
0
func (h *authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	user, _, err := authorizeSession(r, kSessionStore)
	if err == errNotLoggedIn {
		http_util.Redirect(
			w,
			r,
			http_util.NewUrl("/auth/login", "prev", r.URL.String()).String())
		return
	}
	if err != nil {
		http_util.ReportError(w, "Error reading database.", err)
		return
	}
	logging.SetUserName(r, user.Name)
	h.ServeMux.ServeHTTP(w, r)
}
Exemplo n.º 2
0
Arquivo: home.go Projeto: keep94/vsafe
func (v *view) EntryLink(id int64) *url.URL {
	return http_util.NewUrl(
		"/vsafe/single",
		"id", strconv.FormatInt(id, 10),
		"prev", v.Url.String())
}