diff --git a/cmd/dex-worker/main.go b/cmd/dex-worker/main.go index 8a7166bf..ea0e9527 100644 --- a/cmd/dex-worker/main.go +++ b/cmd/dex-worker/main.go @@ -28,7 +28,9 @@ func init() { func main() { fs := flag.NewFlagSet("dex-worker", flag.ExitOnError) listen := fs.String("listen", "http://127.0.0.1:5556", "the address that the server will listen on") + issuer := fs.String("issuer", "http://127.0.0.1:5556", "the issuer's location") + certFile := fs.String("tls-cert-file", "", "the server's certificate file for TLS connection") keyFile := fs.String("tls-key-file", "", "the server's private key file for TLS connection") @@ -42,6 +44,10 @@ func main() { noDB := fs.Bool("no-db", false, "manage entities in-process w/o any encryption, used only for single-node testing") + // UI-related: + issuerName := fs.String("issuer-name", "dex", "The name of this dex installation; will appear on most pages.") + issuerLogoURL := fs.String("issuer-logo-url", "https://coreos.com/assets/images/brand/coreos-wordmark-135x40px.png", "URL of an image representing the issuer") + // ignored if --no-db is set dbURL := fs.String("db-url", "", "DSN-formatted database connection string") @@ -110,6 +116,8 @@ func main() { EmailTemplateDirs: emailTemplateDirs, EmailFromAddress: *emailFrom, EmailerConfigFile: *emailConfig, + IssuerName: *issuerName, + IssuerLogoURL: *issuerLogoURL, } if *noDB { diff --git a/server/config.go b/server/config.go index b44ad702..3c3d4432 100644 --- a/server/config.go +++ b/server/config.go @@ -26,6 +26,8 @@ import ( type ServerConfig struct { IssuerURL string + IssuerName string + IssuerLogoURL string TemplateDir string EmailTemplateDirs []string EmailFromAddress string @@ -54,7 +56,7 @@ func (cfg *ServerConfig) Server() (*Server, error) { return nil, err } - tpl, err := getTemplates(cfg.TemplateDir) + tpl, err := getTemplates(cfg.IssuerName, cfg.IssuerLogoURL, cfg.TemplateDir) if err != nil { return nil, err } @@ -181,8 +183,17 @@ func (cfg *MultiServerConfig) Configure(srv *Server) error { return nil } -func getTemplates(dir string) (*template.Template, error) { - return template.ParseGlob(dir + "/*.html") +func getTemplates(issuerName, issuerLogoURL string, dir string) (*template.Template, error) { + tpl := template.New("").Funcs(map[string]interface{}{ + "issuerName": func() string { + return issuerName + }, + "issuerLogoURL": func() string { + return issuerLogoURL + }, + }) + + return tpl.ParseGlob(dir + "/*.html") } func setTemplates(srv *Server, tpls *template.Template) error { diff --git a/server/testutil.go b/server/testutil.go index 20c3080c..8df077e4 100644 --- a/server/testutil.go +++ b/server/testutil.go @@ -126,7 +126,7 @@ func makeTestFixtures() (*testFixtures, error) { return nil, err } - tpl, err := getTemplates(templatesLocation) + tpl, err := getTemplates("dex", "https://coreos.com/assets/images/brand/coreos-mark-30px.png", templatesLocation) if err != nil { return nil, err } diff --git a/static/html/header.html b/static/html/header.html index 1aa0a86d..0d16c7b8 100644 --- a/static/html/header.html +++ b/static/html/header.html @@ -206,7 +206,7 @@ diff --git a/static/html/login.html b/static/html/login.html index 8a6cda3c..330497f5 100644 --- a/static/html/login.html +++ b/static/html/login.html @@ -9,10 +9,10 @@

{{ .Message }}

{{ else }} {{ if and .Register (eq .MsgCode "") }} -

Create Your Account

+

Create Your {{ issuerName }} Account

Verify using either option below
{{ else }} -

Log in to Your Account

+

Log in to {{ issuerName }}

{{ end}} {{ end }}