diff options
author | Timo Ley <auth@tilera.xyz> | 2020-12-28 03:35:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-28 03:35:55 +0100 |
commit | 2b2a4a53bfea37b64965a9e04aed93b7455048df (patch) | |
tree | b17a79c47cba12ec64474df96b556e14d6b05a67 /models | |
parent | f6ca44c706479fc8565021ca9e50082b64a21c1f (diff) | |
download | gitea-2b2a4a53bfea37b64965a9e04aed93b7455048df.tar.gz gitea-2b2a4a53bfea37b64965a9e04aed93b7455048df.zip |
Custom icons for OAuth sources (#14161)
* Add Icon URL to Backend
* Template for Icon URL
* Localization & Edit Icon URL
* Improve Custom Icon URL
* Removed not working else
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'models')
-rw-r--r-- | models/login_source.go | 1 | ||||
-rw-r--r-- | models/oauth2.go | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/models/login_source.go b/models/login_source.go index 4f577d6ca7..f1941c3e78 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -131,6 +131,7 @@ type OAuth2Config struct { ClientSecret string OpenIDConnectAutoDiscoveryURL string CustomURLMapping *oauth2.CustomURLMapping + IconURL string } // FromDB fills up an OAuth2Config from serialized format. diff --git a/models/oauth2.go b/models/oauth2.go index 27668d5eec..241e11a44d 100644 --- a/models/oauth2.go +++ b/models/oauth2.go @@ -111,7 +111,11 @@ func GetActiveOAuth2Providers() ([]string, map[string]OAuth2Provider, error) { var orderedKeys []string providers := make(map[string]OAuth2Provider) for _, source := range loginSources { - providers[source.Name] = OAuth2Providers[source.OAuth2().Provider] + prov := OAuth2Providers[source.OAuth2().Provider] + if source.OAuth2().IconURL != "" { + prov.Image = source.OAuth2().IconURL + } + providers[source.Name] = prov orderedKeys = append(orderedKeys, source.Name) } |