Login: Allow custom name and icon for social providers (#63297)

This commit is contained in:
Jan-Otto Kröpke 2023-03-03 09:17:43 +01:00 committed by GitHub
parent a7a658ed1b
commit c323a7cb13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 12 deletions

View File

@ -521,6 +521,8 @@ hide_version = false
#################################### GitHub Auth ######################### #################################### GitHub Auth #########################
[auth.github] [auth.github]
name = GitHub
icon = github
enabled = false enabled = false
allow_sign_up = true allow_sign_up = true
auto_login = false auto_login = false
@ -539,6 +541,8 @@ allow_assign_grafana_admin = false
#################################### GitLab Auth ######################### #################################### GitLab Auth #########################
[auth.gitlab] [auth.gitlab]
name = GitLab
icon = gitlab
enabled = false enabled = false
allow_sign_up = true allow_sign_up = true
auto_login = false auto_login = false
@ -557,6 +561,8 @@ skip_org_role_sync = false
#################################### Google Auth ######################### #################################### Google Auth #########################
[auth.google] [auth.google]
name = Google
icon = google
enabled = false enabled = false
allow_sign_up = true allow_sign_up = true
auto_login = false auto_login = false
@ -581,6 +587,8 @@ scopes = user:email
allowed_organizations = allowed_organizations =
[auth.grafana_com] [auth.grafana_com]
name = Grafana.com
icon = grafana
enabled = false enabled = false
allow_sign_up = true allow_sign_up = true
auto_login = false auto_login = false
@ -592,7 +600,8 @@ skip_org_role_sync = false
#################################### Azure AD OAuth ####################### #################################### Azure AD OAuth #######################
[auth.azuread] [auth.azuread]
name = Azure AD name = Microsoft
icon = microsoft
enabled = false enabled = false
allow_sign_up = true allow_sign_up = true
auto_login = false auto_login = false

View File

@ -525,6 +525,8 @@
#################################### GitHub Auth ########################## #################################### GitHub Auth ##########################
[auth.github] [auth.github]
;name = GitHub
;icon = github
;enabled = false ;enabled = false
;allow_sign_up = true ;allow_sign_up = true
;auto_login = false ;auto_login = false
@ -543,6 +545,8 @@
#################################### GitLab Auth ######################### #################################### GitLab Auth #########################
[auth.gitlab] [auth.gitlab]
;name = GitLab
;icon = gitlab
;enabled = false ;enabled = false
;allow_sign_up = true ;allow_sign_up = true
;auto_login = false ;auto_login = false
@ -561,6 +565,8 @@
#################################### Google Auth ########################## #################################### Google Auth ##########################
[auth.google] [auth.google]
;name = Google
;icon = google
;enabled = false ;enabled = false
;allow_sign_up = true ;allow_sign_up = true
;auto_login = false ;auto_login = false
@ -576,6 +582,8 @@
#################################### Grafana.com Auth #################### #################################### Grafana.com Auth ####################
[auth.grafana_com] [auth.grafana_com]
;name = Grafana.com
;icon = grafana
;enabled = false ;enabled = false
;allow_sign_up = true ;allow_sign_up = true
;auto_login = false ;auto_login = false
@ -587,7 +595,8 @@
#################################### Azure AD OAuth ####################### #################################### Azure AD OAuth #######################
[auth.azuread] [auth.azuread]
;name = Azure AD ;name = Microsoft
;icon = microsoft
;enabled = false ;enabled = false
;allow_sign_up = true ;allow_sign_up = true
;auto_login = false ;auto_login = false

View File

@ -31,32 +31,32 @@ const loginServices: () => LoginServices = () => {
google: { google: {
bgColor: '#e84d3c', bgColor: '#e84d3c',
enabled: oauthEnabled && Boolean(config.oauth.google), enabled: oauthEnabled && Boolean(config.oauth.google),
name: 'Google', name: config.oauth?.google?.name || 'Google',
icon: 'google', icon: config.oauth?.google?.icon ?? ('google' as const),
}, },
azuread: { azuread: {
bgColor: '#2f2f2f', bgColor: '#2f2f2f',
enabled: oauthEnabled && Boolean(config.oauth.azuread), enabled: oauthEnabled && Boolean(config.oauth.azuread),
name: 'Microsoft', name: config.oauth?.azuread?.name || 'Microsoft',
icon: 'microsoft', icon: config.oauth?.azuread?.icon ?? ('microsoft' as const),
}, },
github: { github: {
bgColor: '#464646', bgColor: '#464646',
enabled: oauthEnabled && Boolean(config.oauth.github), enabled: oauthEnabled && Boolean(config.oauth.github),
name: 'GitHub', name: config.oauth?.github?.name || 'GitHub',
icon: 'github', icon: config.oauth?.github?.icon ?? ('github' as const),
}, },
gitlab: { gitlab: {
bgColor: '#fc6d26', bgColor: '#fc6d26',
enabled: oauthEnabled && Boolean(config.oauth.gitlab), enabled: oauthEnabled && Boolean(config.oauth.gitlab),
name: 'GitLab', name: config.oauth?.gitlab?.name || 'GitLab',
icon: 'gitlab', icon: config.oauth?.gitlab?.icon ?? ('gitlab' as const),
}, },
grafanacom: { grafanacom: {
bgColor: '#262628', bgColor: '#262628',
enabled: oauthEnabled && Boolean(config.oauth.grafana_com), enabled: oauthEnabled && Boolean(config.oauth.grafana_com),
name: 'Grafana.com', name: config.oauth?.grafana_com?.name || 'Grafana.com',
icon: 'grafana', icon: config.oauth?.grafana_com?.icon ?? ('grafana' as const),
hrefName: 'grafana_com', hrefName: 'grafana_com',
}, },
okta: { okta: {