func (ro RouteHandler) View(w *webby.Web) { truth := ro.Init(w) if w.CutOut() { return } if !truth { w.Error403() return } var form *Form switch t := w.Session.(type) { case Form: form = &t w.DestroySession() case *Form: form = t w.DestroySession() default: form = ro.FetchForm(w) } if w.Req.Method == "POST" { goto post } if w.Req.URL.RawQuery != "" { if form.IsValid(w) { goto pass } else { goto get } } get: ro.Get(w, form) return post: if !form.IsValid(w) { goto fail } pass: ro.PostPass(w) return fail: w.SetSession(form) ro.PostFail(w) }
func formCheck(w *webby.Web) { form := w.Form() if len(form.Value) <= 0 { return } if len(form.Value[cookieName]) <= 0 { w.Error403() return } if form.Value[cookieName][0] != getCookie(w).Value { w.Error403() return } }
func fail(w *webby.Web) { w.Error403() }