Example #1
0
func Login(w http.ResponseWriter, req *http.Request) {
	username := req.FormValue("username")
	password := req.FormValue("password")
	foundUsername, sql := phial.Login(username, password)

	w.Header().Set("X-SQL", sql)

	switch u := foundUsername.(type) {
	case string:
		w.WriteHeader(200)
		views.WriteSuccess(w, u)
		return
	case nil:
		w.WriteHeader(403)
		views.WriteIndex(w)
		return
	}
}
Example #2
0
func Index(w http.ResponseWriter, req *http.Request) {
	views.WriteIndex(w)
}