diff --git a/account.go b/account.go index 92b1523..236dfb3 100644 --- a/account.go +++ b/account.go @@ -304,32 +304,18 @@ func viewLogin(app *App, w http.ResponseWriter, r *http.Request) error { p := &struct { page.StaticPage - To string - Message template.HTML - Flashes []template.HTML - LoginUsername string - OauthSlack bool - OauthWriteAs bool - OauthGitlab bool - GitlabDisplayName string - OauthGeneric bool - OauthGenericDisplayName string - OauthGitea bool - GiteaDisplayName string + *OAuthButtons + To string + Message template.HTML + Flashes []template.HTML + LoginUsername string }{ - StaticPage: pageForReq(app, r), - To: r.FormValue("to"), - Message: template.HTML(""), - Flashes: []template.HTML{}, - LoginUsername: getTempInfo(app, "login-user", r, w), - OauthSlack: app.Config().SlackOauth.ClientID != "", - OauthWriteAs: app.Config().WriteAsOauth.ClientID != "", - OauthGitlab: app.Config().GitlabOauth.ClientID != "", - GitlabDisplayName: config.OrDefaultString(app.Config().GitlabOauth.DisplayName, gitlabDisplayName), - OauthGeneric: app.Config().GenericOauth.ClientID != "", - OauthGenericDisplayName: config.OrDefaultString(app.Config().GenericOauth.DisplayName, genericOauthDisplayName), - OauthGitea: app.Config().GiteaOauth.ClientID != "", - GiteaDisplayName: config.OrDefaultString(app.Config().GiteaOauth.DisplayName, giteaDisplayName), + StaticPage: pageForReq(app, r), + OAuthButtons: NewOAuthButtons(app.Config()), + To: r.FormValue("to"), + Message: template.HTML(""), + Flashes: []template.HTML{}, + LoginUsername: getTempInfo(app, "login-user", r, w), } if earlyError != "" { diff --git a/app.go b/app.go index 06e677b..2aed437 100644 --- a/app.go +++ b/app.go @@ -238,27 +238,16 @@ func handleViewLanding(app *App, w http.ResponseWriter, r *http.Request) error { p := struct { page.StaticPage + *OAuthButtons Flashes []template.HTML Banner template.HTML Content template.HTML ForcedLanding bool - - OauthSlack bool - OauthWriteAs bool - OauthGitlab bool - OauthGeneric bool - OauthGenericDisplayName string - GitlabDisplayName string }{ - StaticPage: pageForReq(app, r), - ForcedLanding: forceLanding, - OauthSlack: app.Config().SlackOauth.ClientID != "", - OauthWriteAs: app.Config().WriteAsOauth.ClientID != "", - OauthGitlab: app.Config().GitlabOauth.ClientID != "", - OauthGeneric: app.Config().GenericOauth.ClientID != "", - OauthGenericDisplayName: config.OrDefaultString(app.Config().GenericOauth.DisplayName, genericOauthDisplayName), - GitlabDisplayName: config.OrDefaultString(app.Config().GitlabOauth.DisplayName, gitlabDisplayName), + StaticPage: pageForReq(app, r), + OAuthButtons: NewOAuthButtons(app.Config()), + ForcedLanding: forceLanding, } banner, err := getLandingBanner(app) diff --git a/oauth.go b/oauth.go index dbcf3bf..620ffaf 100644 --- a/oauth.go +++ b/oauth.go @@ -30,19 +30,27 @@ import ( // OAuthButtons holds display information for different OAuth providers we support. type OAuthButtons struct { - SlackEnabled bool - WriteAsEnabled bool - GitLabEnabled bool - GitLabDisplayName string + SlackEnabled bool + WriteAsEnabled bool + GitLabEnabled bool + GitLabDisplayName string + GiteaEnabled bool + GiteaDisplayName string + GenericEnabled bool + GenericDisplayName string } // NewOAuthButtons creates a new OAuthButtons struct based on our app configuration. func NewOAuthButtons(cfg *config.Config) *OAuthButtons { return &OAuthButtons{ - SlackEnabled: cfg.SlackOauth.ClientID != "", - WriteAsEnabled: cfg.WriteAsOauth.ClientID != "", - GitLabEnabled: cfg.GitlabOauth.ClientID != "", - GitLabDisplayName: config.OrDefaultString(cfg.GitlabOauth.DisplayName, gitlabDisplayName), + SlackEnabled: cfg.SlackOauth.ClientID != "", + WriteAsEnabled: cfg.WriteAsOauth.ClientID != "", + GitLabEnabled: cfg.GitlabOauth.ClientID != "", + GitLabDisplayName: config.OrDefaultString(cfg.GitlabOauth.DisplayName, gitlabDisplayName), + GiteaEnabled: cfg.GiteaOauth.ClientID != "", + GiteaDisplayName: config.OrDefaultString(cfg.GiteaOauth.DisplayName, giteaDisplayName), + GenericEnabled: cfg.GenericOauth.ClientID != "", + GenericDisplayName: config.OrDefaultString(cfg.GenericOauth.DisplayName, genericOauthDisplayName), } } diff --git a/pages/landing.tmpl b/pages/landing.tmpl index e661aa6..2131b40 100644 --- a/pages/landing.tmpl +++ b/pages/landing.tmpl @@ -60,6 +60,9 @@ form dd { margin-top: 0; max-width: 8em; } +.or { + margin-bottom: 2.5em !important; +} {{end}} {{define "content"}} @@ -73,20 +76,7 @@ form dd {
or
-