Beispiel #1
0
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)
}
Beispiel #2
0
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
	}
}
Beispiel #3
0
func fail(w *webby.Web) {
	w.Error403()
}