File tree 6 files changed +14
-12
lines changed
services/auth/source/oauth2
6 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import (
22
22
type Provider interface {
23
23
Name () string
24
24
DisplayName () string
25
- IconHTML () template.HTML
25
+ IconHTML (size int ) template.HTML
26
26
CustomURLSettings () * CustomURLSettings
27
27
}
28
28
@@ -54,14 +54,16 @@ func (p *AuthSourceProvider) DisplayName() string {
54
54
return p .sourceName
55
55
}
56
56
57
- func (p * AuthSourceProvider ) IconHTML () template.HTML {
57
+ func (p * AuthSourceProvider ) IconHTML (size int ) template.HTML {
58
58
if p .iconURL != "" {
59
- img := fmt .Sprintf (`<img class="gt-object-contain gt-mr-3" width="20" height="20" src="%s" alt="%s">` ,
59
+ img := fmt .Sprintf (`<img class="gt-object-contain gt-mr-3" width="%d" height="%d" src="%s" alt="%s">` ,
60
+ size ,
61
+ size ,
60
62
html .EscapeString (p .iconURL ), html .EscapeString (p .DisplayName ()),
61
63
)
62
64
return template .HTML (img )
63
65
}
64
- return p .GothProvider .IconHTML ()
66
+ return p .GothProvider .IconHTML (size )
65
67
}
66
68
67
69
// Providers contains the map of registered OAuth2 providers in Gitea (based on goth)
Original file line number Diff line number Diff line change @@ -27,18 +27,18 @@ func (b *BaseProvider) DisplayName() string {
27
27
}
28
28
29
29
// IconHTML returns icon HTML for this provider
30
- func (b * BaseProvider ) IconHTML () template.HTML {
30
+ func (b * BaseProvider ) IconHTML (size int ) template.HTML {
31
31
svgName := "gitea-" + b .name
32
32
switch b .name {
33
33
case "gplus" :
34
34
svgName = "gitea-google"
35
35
case "github" :
36
36
svgName = "octicon-mark-github"
37
37
}
38
- svgHTML := svg .RenderHTML (svgName , 20 , "gt-mr-3" )
38
+ svgHTML := svg .RenderHTML (svgName , size , "gt-mr-3" )
39
39
if svgHTML == "" {
40
40
log .Error ("No SVG icon for oauth2 provider %q" , b .name )
41
- svgHTML = svg .RenderHTML ("gitea-openid" , 20 , "gt-mr-3" )
41
+ svgHTML = svg .RenderHTML ("gitea-openid" , size , "gt-mr-3" )
42
42
}
43
43
return svgHTML
44
44
}
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ func (o *OpenIDProvider) DisplayName() string {
28
28
}
29
29
30
30
// IconHTML returns icon HTML for this provider
31
- func (o * OpenIDProvider ) IconHTML () template.HTML {
32
- return svg .RenderHTML ("gitea-openid" , 20 , "gt-mr-3" )
31
+ func (o * OpenIDProvider ) IconHTML (size int ) template.HTML {
32
+ return svg .RenderHTML ("gitea-openid" , size , "gt-mr-3" )
33
33
}
34
34
35
35
// CreateGothProvider creates a GothProvider from this Provider
Original file line number Diff line number Diff line change 62
62
{{range $key := .OrderedOAuth2Names}}
63
63
{{$provider := index $.OAuth2Providers $key}}
64
64
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
65
- {{$provider.IconHTML}}
65
+ {{$provider.IconHTML 28 }}
66
66
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
67
67
</a>
68
68
{{end}}
Original file line number Diff line number Diff line change 66
66
{{range $key := .OrderedOAuth2Names}}
67
67
{{$provider := index $.OAuth2Providers $key}}
68
68
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
69
- {{$provider.IconHTML}}
69
+ {{$provider.IconHTML 28 }}
70
70
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
71
71
</a>
72
72
{{end}}
Original file line number Diff line number Diff line change 10
10
{{range $key := .OrderedOAuth2Names}}
11
11
{{$provider := index $.OAuth2Providers $key}}
12
12
<a class="item" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
13
- {{$provider.IconHTML}}
13
+ {{$provider.IconHTML 20 }}
14
14
{{$provider.DisplayName}}
15
15
</a>
16
16
{{end}}
You can’t perform that action at this time.
0 commit comments