Exemplo 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, "")
}
Exemplo 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")

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

}