forked from Gitlink/gitea-1156
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>
This commit is contained in:
parent
f6ca44c706
commit
2b2a4a53bf
|
@ -131,6 +131,7 @@ type OAuth2Config struct {
|
|||
ClientSecret string
|
||||
OpenIDConnectAutoDiscoveryURL string
|
||||
CustomURLMapping *oauth2.CustomURLMapping
|
||||
IconURL string
|
||||
}
|
||||
|
||||
// FromDB fills up an OAuth2Config from serialized format.
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ type AuthenticationForm struct {
|
|||
Oauth2AuthURL string
|
||||
Oauth2ProfileURL string
|
||||
Oauth2EmailURL string
|
||||
Oauth2IconURL string
|
||||
SSPIAutoCreateUsers bool
|
||||
SSPIAutoActivateUsers bool
|
||||
SSPIStripDomainNames bool
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -177,6 +177,7 @@ func parseOAuth2Config(form auth.AuthenticationForm) *models.OAuth2Config {
|
|||
ClientSecret: form.Oauth2Secret,
|
||||
OpenIDConnectAutoDiscoveryURL: form.OpenIDConnectAutoDiscoveryURL,
|
||||
CustomURLMapping: customURLMapping,
|
||||
IconURL: form.Oauth2IconURL,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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}}">
|
||||
|
|
|
@ -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}}">
|
||||
|
|
Loading…
Reference in New Issue