Esempio n. 1
0
func userLoginForm(w http.ResponseWriter, r *http.Request) {
	s := session.Get(w, r)
	if s.IsAuthenticated() {
		fmt.Fprintln(w, "You are authed!")
	}
	template.Get("user/login").Render(w, "")
}
Esempio n. 2
0
func userLoginSubmit(w http.ResponseWriter, r *http.Request) {
	user := new(User)
	user.fromRequest(r)
	if !user.passwordOk() {
		fmt.Fprintln(w, "bad password dude")
	}
	session.Get(w, r).Authenticate()
	route.Redirect(w, r, "meat.list")

}
Esempio n. 3
0
func userLogout(w http.ResponseWriter, r *http.Request) {
	session.Get(w, r).Logout()
	route.Redirect(w, r, "user.login")

}