Exemple #1
0
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)
}
Exemple #2
0
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)
}
Exemple #3
0
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)
}