mirror of
https://github.com/xslasd/x-oidc.git
synced 2025-10-06 08:27:05 +08:00
30 lines
602 B
Go
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"),
|
|
})
|
|
}
|
|
})
|
|
}
|