diff --git a/services/auth/source/oauth2/providers.go b/services/auth/source/oauth2/providers.go index 7572aa20c..e3a0cb033 100644 --- a/services/auth/source/oauth2/providers.go +++ b/services/auth/source/oauth2/providers.go @@ -22,7 +22,7 @@ import ( type Provider interface { Name() string DisplayName() string - IconHTML() template.HTML + IconHTML(size int) template.HTML CustomURLSettings() *CustomURLSettings } @@ -54,14 +54,16 @@ func (p *AuthSourceProvider) DisplayName() string { return p.sourceName } -func (p *AuthSourceProvider) IconHTML() template.HTML { +func (p *AuthSourceProvider) IconHTML(size int) template.HTML { if p.iconURL != "" { - img := fmt.Sprintf(`%s`, + img := fmt.Sprintf(`%s`, + size, + size, html.EscapeString(p.iconURL), html.EscapeString(p.DisplayName()), ) return template.HTML(img) } - return p.GothProvider.IconHTML() + return p.GothProvider.IconHTML(size) } // Providers contains the map of registered OAuth2 providers in Gitea (based on goth) diff --git a/services/auth/source/oauth2/providers_base.go b/services/auth/source/oauth2/providers_base.go index 5ba06feba..5b6694487 100644 --- a/services/auth/source/oauth2/providers_base.go +++ b/services/auth/source/oauth2/providers_base.go @@ -27,7 +27,7 @@ func (b *BaseProvider) DisplayName() string { } // IconHTML returns icon HTML for this provider -func (b *BaseProvider) IconHTML() template.HTML { +func (b *BaseProvider) IconHTML(size int) template.HTML { svgName := "gitea-" + b.name switch b.name { case "gplus": @@ -35,10 +35,10 @@ func (b *BaseProvider) IconHTML() template.HTML { case "github": svgName = "octicon-mark-github" } - svgHTML := svg.RenderHTML(svgName, 20, "gt-mr-3") + svgHTML := svg.RenderHTML(svgName, size, "gt-mr-3") if svgHTML == "" { log.Error("No SVG icon for oauth2 provider %q", b.name) - svgHTML = svg.RenderHTML("gitea-openid", 20, "gt-mr-3") + svgHTML = svg.RenderHTML("gitea-openid", size, "gt-mr-3") } return svgHTML } diff --git a/services/auth/source/oauth2/providers_openid.go b/services/auth/source/oauth2/providers_openid.go index 54530ae8a..a4dcfcafc 100644 --- a/services/auth/source/oauth2/providers_openid.go +++ b/services/auth/source/oauth2/providers_openid.go @@ -28,8 +28,8 @@ func (o *OpenIDProvider) DisplayName() string { } // IconHTML returns icon HTML for this provider -func (o *OpenIDProvider) IconHTML() template.HTML { - return svg.RenderHTML("gitea-openid", 20, "gt-mr-3") +func (o *OpenIDProvider) IconHTML(size int) template.HTML { + return svg.RenderHTML("gitea-openid", size, "gt-mr-3") } // CreateGothProvider creates a GothProvider from this Provider diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index ec4852422..2b72f119c 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -62,7 +62,7 @@ {{range $key := .OrderedOAuth2Names}} {{$provider := index $.OAuth2Providers $key}} - {{$provider.IconHTML}} + {{$provider.IconHTML 28}} {{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}} {{end}} diff --git a/templates/user/auth/signup_inner.tmpl b/templates/user/auth/signup_inner.tmpl index 931efcf04..e3dd33783 100644 --- a/templates/user/auth/signup_inner.tmpl +++ b/templates/user/auth/signup_inner.tmpl @@ -66,7 +66,7 @@ {{range $key := .OrderedOAuth2Names}} {{$provider := index $.OAuth2Providers $key}} - {{$provider.IconHTML}} + {{$provider.IconHTML 28}} {{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}} {{end}} diff --git a/templates/user/settings/security/accountlinks.tmpl b/templates/user/settings/security/accountlinks.tmpl index f64277b5a..7fbd39cbd 100644 --- a/templates/user/settings/security/accountlinks.tmpl +++ b/templates/user/settings/security/accountlinks.tmpl @@ -10,7 +10,7 @@ {{range $key := .OrderedOAuth2Names}} {{$provider := index $.OAuth2Providers $key}} - {{$provider.IconHTML}} + {{$provider.IconHTML 20}} {{$provider.DisplayName}} {{end}}