func (u *User) newRequest(f ui.Form) (*request, error) {
	var validator func() bool
	var handler func(body string)
	switch f.URL.Path {
	case "/user_create", "/user_update_password":
		handler = func(body string) {
			u.dom.StoreCredentials(f.Element)
			u.Logout()
		}
	case "/user_delete":
		validator = func() bool {
			message := "Are you sure? All accumulated points will be lost"
			ok := u.dom.Confirm(message)
			return ok
		}
		handler = func(body string) {
			u.Logout()
		}
	case "/user_login":
		handler = func(body string) {
			u.dom.StoreCredentials(f.Element)
			u.login(body)
		}
	case "/ping":
		// NOOP
	default:
		return nil, errors.New("Unknown action: " + f.URL.Path)
	}
	r := request{
		user:      u,
		form:      f,
		validator: validator,
		handler:   handler,
	}
	return &r, nil
}
// responseHandler creates a response-handling function for the url and form.  Nil is returned if the url is unknown.Path
responseHandler creates a response-handling function for the url and form.  Nil is returned if the url is unknown.Path
// responseHandler creates a response - handling function for the url and form . Nil is returned if the url is unknown . Path
func (u *User) newRequest(f ui.Form) (*request, error) {
	var validator func() bool
	var handler func(body string)
	switch f.URL.Path {
	case "/user_create", "/user_update_password":
		handler = func(body string) {
			u.dom.StoreCredentials(f.Element)
			u.Logout()
		}
	case "/user_delete":
		validator = func() bool {
			message := "Are you sure? All accumulated points will be lost"
			ok := u.dom.Confirm(message)
			return ok
		}
		handler = func(body string) {
			u.Logout()
		}
	case "/user_login":
		handler = func(body string) {
			u.dom.StoreCredentials(f.Element)
			u.login(body)
		}
	case "/ping":
	default:
		return nil, errors.New("Unknown action: " + f.URL.Path)
	}
	r := request{
		user:      u,
		form:      f,
		validator: validator,
		handler:   handler,
	}
	return &r, nil
}
func ( u * User ) newRequest ( f ui . Form ) ( * request , error ) { var validator func ( ) bool var handler func ( body string ) switch f . URL . Path { case " " , " " : handler = func ( body string ) { u . dom . StoreCredentials ( f . Element ) u . Logout ( ) } case " " : validator = func ( ) bool { message := " " ok := u . dom . Confirm ( message ) return ok } handler = func ( body string ) { u . Logout ( ) } case " " : handler = func ( body string ) { u . dom . StoreCredentials ( f . Element ) u . login ( body ) } case " " : default : return nil , errors . New ( " " + f . URL . Path ) } r := request { user : u , form : f , validator : validator , handler : handler , } return & r , nil }
responseHandler creates a response-handling function for the url and form.
responseHandler creates a response - handling function for the url and form .
// NOOP