func LoginGET(ctx context.Context, w http.ResponseWriter, r *http.Request, webui services.WebUIClient) { resp, err := webui.LoginGET(ctx, new(records.LoginGETRequest)) if err != nil { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } resp.ServeHTTP(w, r) }
func RegisterGET(ctx context.Context, w http.ResponseWriter, r *http.Request, webui services.WebUIClient) { resp, err := webui.RegisterGET(ctx, new(records.RegisterGETRequest)) if err != nil { log.Print("webui.RegisterGET error: %v", err) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } resp.ServeHTTP(w, r) }
func LoginPOST(ctx context.Context, w http.ResponseWriter, r *http.Request, webui services.WebUIClient) { if err := r.ParseForm(); err != nil { log.Printf("r.ParseForm error: %v", err) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } resp, err := webui.LoginPOST(ctx, &records.LoginPOSTRequest{ Public: r.FormValue("public"), Private: r.FormValue("private"), }) if err != nil { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } resp.ServeHTTP(w, r) }