Files
x-oidc/example/server/httpwrapper/login.go
xsl d6cf6be6d4 edit README.md
add NOTICE file
Naming of repair methods
2023-06-05 11:16:23 +08:00

30 lines
602 B
Go

package httpwrapper
import (
"embed"
"fmt"
"html/template"
"net/http"
)
var (
//go:embed templates
templateFS embed.FS
templates = template.Must(template.ParseFS(templateFS, "templates/*.html"))
)
func (h *HttpWrapper) login() {
h.handler.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
http.Error(w, fmt.Sprintf("cannot parse form:%s", err), http.StatusInternalServerError)
return
}
if r.Method == "GET" {
templates.ExecuteTemplate(w, "login", map[string]string{
"ID": r.Form.Get("request_id"),
})
}
})
}