mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-02-03 13:21:51 +02:00
38 lines
808 B
Go
38 lines
808 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"html/template"
|
||
|
"log"
|
||
|
)
|
||
|
|
||
|
func getTemplates() *template.Template {
|
||
|
t, err := template.New("foo").Parse(`{{define "sign_in.html"}}
|
||
|
<html><head><title>Sign In</title></head>
|
||
|
<body>
|
||
|
<form method="GET" action="/oauth2/start">
|
||
|
<button type="submit">Sign In w/ Google</button>
|
||
|
{{.SignInMessage}}
|
||
|
</form>
|
||
|
</body></html>
|
||
|
{{end}}`)
|
||
|
if err != nil {
|
||
|
log.Fatalf("failed parsing template %s", err.Error())
|
||
|
}
|
||
|
t, err = t.Parse(`{{define "error.html"}}
|
||
|
<html><head><title>{{.Title}}</title></head>
|
||
|
<body>
|
||
|
<h2>{{.Title}}</h2>
|
||
|
<p>{{.Message}}</p>
|
||
|
<hr>
|
||
|
<form method="GET" action="/oauth2/start">
|
||
|
<button type="submit">Sign In w/ Google</button>
|
||
|
{{.SignInMessage}}
|
||
|
</form>
|
||
|
</body>
|
||
|
</html>{{end}}`)
|
||
|
if err != nil {
|
||
|
log.Fatalf("failed parsing template %s", err.Error())
|
||
|
}
|
||
|
return t
|
||
|
}
|