*: port oob template
This commit is contained in:
@@ -15,6 +15,7 @@ const (
|
||||
tmplApproval = "approval.html"
|
||||
tmplLogin = "login.html"
|
||||
tmplPassword = "password.html"
|
||||
tmplOOB = "oob.html"
|
||||
)
|
||||
|
||||
const coreOSLogoURL = "https://coreos.com/assets/images/brand/coreos-wordmark-135x40px.png"
|
||||
@@ -23,6 +24,7 @@ var requiredTmpls = []string{
|
||||
tmplApproval,
|
||||
tmplLogin,
|
||||
tmplPassword,
|
||||
tmplOOB,
|
||||
}
|
||||
|
||||
// TemplateConfig describes.
|
||||
@@ -106,6 +108,7 @@ func loadTemplates(config TemplateConfig) (*templates, error) {
|
||||
loginTmpl: tmpls.Lookup(tmplLogin),
|
||||
approvalTmpl: tmpls.Lookup(tmplApproval),
|
||||
passwordTmpl: tmpls.Lookup(tmplPassword),
|
||||
oobTmpl: tmpls.Lookup(tmplOOB),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -120,6 +123,7 @@ type templates struct {
|
||||
loginTmpl *template.Template
|
||||
approvalTmpl *template.Template
|
||||
passwordTmpl *template.Template
|
||||
oobTmpl *template.Template
|
||||
}
|
||||
|
||||
type connectorInfo struct {
|
||||
@@ -175,6 +179,14 @@ func (t *templates) approval(w http.ResponseWriter, state, username, clientName
|
||||
renderTemplate(w, t.approvalTmpl, data)
|
||||
}
|
||||
|
||||
func (t *templates) oob(w http.ResponseWriter, code string) {
|
||||
data := struct {
|
||||
TemplateConfig
|
||||
Code string
|
||||
}{t.globalData, code}
|
||||
renderTemplate(w, t.oobTmpl, data)
|
||||
}
|
||||
|
||||
// small io.Writer utilitiy to determine if executing the template wrote to the underlying response writer.
|
||||
type writeRecorder struct {
|
||||
wrote bool
|
||||
|
||||
Reference in New Issue
Block a user