summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/login_source.go1
-rw-r--r--models/oauth2.go6
-rw-r--r--modules/auth/auth_form.go1
-rw-r--r--options/locale/locale_en-US.ini1
-rw-r--r--routers/admin/auths.go1
-rw-r--r--templates/admin/auth/edit.tmpl4
-rw-r--r--templates/admin/auth/source/oauth.tmpl4
7 files changed, 17 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)
}
diff --git a/modules/auth/auth_form.go b/modules/auth/auth_form.go
index 1d02c7acf3..e348b01e91 100644
--- a/modules/auth/auth_form.go
+++ b/modules/auth/auth_form.go
@@ -56,6 +56,7 @@ type AuthenticationForm struct {
Oauth2AuthURL string
Oauth2ProfileURL string
Oauth2EmailURL string
+ Oauth2IconURL string
SSPIAutoCreateUsers bool
SSPIAutoActivateUsers bool
SSPIStripDomainNames bool
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 3aff43c0a8..ae72dff3ad 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2203,6 +2203,7 @@ auths.enable_tls = Enable TLS Encryption
auths.skip_tls_verify = Skip TLS Verify
auths.pam_service_name = PAM Service Name
auths.oauth2_provider = OAuth2 Provider
+auths.oauth2_icon_url = Icon URL
auths.oauth2_clientID = Client ID (Key)
auths.oauth2_clientSecret = Client Secret
auths.openIdConnectAutoDiscoveryURL = OpenID Connect Auto Discovery URL
diff --git a/routers/admin/auths.go b/routers/admin/auths.go
index ce9dd38360..7a9d286373 100644
--- a/routers/admin/auths.go
+++ b/routers/admin/auths.go
@@ -177,6 +177,7 @@ func parseOAuth2Config(form auth.AuthenticationForm) *models.OAuth2Config {
ClientSecret: form.Oauth2Secret,
OpenIDConnectAutoDiscoveryURL: form.OpenIDConnectAutoDiscoveryURL,
CustomURLMapping: customURLMapping,
+ IconURL: form.Oauth2IconURL,
}
}
diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl
index 3347a91bf6..6b24858395 100644
--- a/templates/admin/auth/edit.tmpl
+++ b/templates/admin/auth/edit.tmpl
@@ -214,6 +214,10 @@
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
<input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required>
</div>
+ <div class="optional field">
+ <label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
+ <input id="oauth2_icon_url" name="oauth2_icon_url" value="{{$cfg.IconURL}}">
+ </div>
<div class="open_id_connect_auto_discovery_url required field">
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
<input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{$cfg.OpenIDConnectAutoDiscoveryURL}}">
diff --git a/templates/admin/auth/source/oauth.tmpl b/templates/admin/auth/source/oauth.tmpl
index 7870dbd65d..1489ab8394 100644
--- a/templates/admin/auth/source/oauth.tmpl
+++ b/templates/admin/auth/source/oauth.tmpl
@@ -20,6 +20,10 @@
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
<input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}">
</div>
+ <div class="optional field">
+ <label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
+ <input id="oauth2_icon_url" name="oauth2_icon_url" value="{{.oauth2_icon_url}}">
+ </div>
<div class="open_id_connect_auto_discovery_url required field">
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
<input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{.open_id_connect_auto_discovery_url}}">