Add color properties to config to white label login buttons (#7826)

Этот коммит содержится в:
Chris Duarte
2018-01-02 13:36:31 -08:00
коммит произвёл Christopher Speller
родитель df09f87def
Коммит 15cc449758
3 изменённых файлов: 69 добавлений и 3 удалений

Просмотреть файл

@@ -165,7 +165,10 @@
"EmailBatchingBufferSize": 256, "EmailBatchingBufferSize": 256,
"EmailBatchingInterval": 30, "EmailBatchingInterval": 30,
"SkipServerCertificateVerification": false, "SkipServerCertificateVerification": false,
"EmailNotificationContentsType": "full" "EmailNotificationContentsType": "full",
"LoginButtonColor": "",
"LoginButtonBorderColor": "",
"LoginButtonTextColor": ""
}, },
"RateLimitSettings": { "RateLimitSettings": {
"Enable": false, "Enable": false,
@@ -248,7 +251,10 @@
"SkipCertificateVerification": false, "SkipCertificateVerification": false,
"QueryTimeout": 60, "QueryTimeout": 60,
"MaxPageSize": 0, "MaxPageSize": 0,
"LoginFieldName": "" "LoginFieldName": "",
"LoginButtonColor": "",
"LoginButtonBorderColor": "",
"LoginButtonTextColor": ""
}, },
"ComplianceSettings": { "ComplianceSettings": {
"Enable": false, "Enable": false,
@@ -278,7 +284,10 @@
"NicknameAttribute": "", "NicknameAttribute": "",
"LocaleAttribute": "", "LocaleAttribute": "",
"PositionAttribute": "", "PositionAttribute": "",
"LoginButtonText": "With SAML" "LoginButtonText": "With SAML",
"LoginButtonColor": "",
"LoginButtonBorderColor": "",
"LoginButtonTextColor": ""
}, },
"NativeAppSettings": { "NativeAppSettings": {
"AppDownloadLink": "https://about.mattermost.com/downloads/", "AppDownloadLink": "https://about.mattermost.com/downloads/",

Просмотреть файл

@@ -688,6 +688,9 @@ type EmailSettings struct {
EmailBatchingInterval *int EmailBatchingInterval *int
SkipServerCertificateVerification *bool SkipServerCertificateVerification *bool
EmailNotificationContentsType *string EmailNotificationContentsType *string
LoginButtonColor *string
LoginButtonBorderColor *string
LoginButtonTextColor *string
} }
func (s *EmailSettings) SetDefaults() { func (s *EmailSettings) SetDefaults() {
@@ -755,6 +758,18 @@ func (s *EmailSettings) SetDefaults() {
if s.EmailNotificationContentsType == nil { if s.EmailNotificationContentsType == nil {
s.EmailNotificationContentsType = NewString(EMAIL_NOTIFICATION_CONTENTS_FULL) s.EmailNotificationContentsType = NewString(EMAIL_NOTIFICATION_CONTENTS_FULL)
} }
if s.LoginButtonColor == nil {
s.LoginButtonColor = NewString("#0000")
}
if s.LoginButtonBorderColor == nil {
s.LoginButtonBorderColor = NewString("#2389D7")
}
if s.LoginButtonTextColor == nil {
s.LoginButtonTextColor = NewString("#2389D7")
}
} }
type RateLimitSettings struct { type RateLimitSettings struct {
@@ -1069,6 +1084,10 @@ type LdapSettings struct {
// Customization // Customization
LoginFieldName *string LoginFieldName *string
LoginButtonColor *string
LoginButtonBorderColor *string
LoginButtonTextColor *string
} }
func (s *LdapSettings) SetDefaults() { func (s *LdapSettings) SetDefaults() {
@@ -1156,6 +1175,18 @@ func (s *LdapSettings) SetDefaults() {
if s.LoginFieldName == nil { if s.LoginFieldName == nil {
s.LoginFieldName = NewString(LDAP_SETTINGS_DEFAULT_LOGIN_FIELD_NAME) s.LoginFieldName = NewString(LDAP_SETTINGS_DEFAULT_LOGIN_FIELD_NAME)
} }
if s.LoginButtonColor == nil {
s.LoginButtonColor = NewString("#0000")
}
if s.LoginButtonBorderColor == nil {
s.LoginButtonBorderColor = NewString("#2389D7")
}
if s.LoginButtonTextColor == nil {
s.LoginButtonTextColor = NewString("#2389D7")
}
} }
type ComplianceSettings struct { type ComplianceSettings struct {
@@ -1224,6 +1255,10 @@ type SamlSettings struct {
PositionAttribute *string PositionAttribute *string
LoginButtonText *string LoginButtonText *string
LoginButtonColor *string
LoginButtonBorderColor *string
LoginButtonTextColor *string
} }
func (s *SamlSettings) SetDefaults() { func (s *SamlSettings) SetDefaults() {
@@ -1298,6 +1333,18 @@ func (s *SamlSettings) SetDefaults() {
if s.LocaleAttribute == nil { if s.LocaleAttribute == nil {
s.LocaleAttribute = NewString(SAML_SETTINGS_DEFAULT_LOCALE_ATTRIBUTE) s.LocaleAttribute = NewString(SAML_SETTINGS_DEFAULT_LOCALE_ATTRIBUTE)
} }
if s.LoginButtonColor == nil {
s.LoginButtonColor = NewString("#34a28b")
}
if s.LoginButtonBorderColor == nil {
s.LoginButtonBorderColor = NewString("#2389D7")
}
if s.LoginButtonTextColor == nil {
s.LoginButtonTextColor = NewString("#ffffff")
}
} }
type NativeAppSettings struct { type NativeAppSettings struct {

Просмотреть файл

@@ -501,6 +501,10 @@ func getClientConfig(c *model.Config) map[string]string {
props["EnableEmailBatching"] = strconv.FormatBool(*c.EmailSettings.EnableEmailBatching) props["EnableEmailBatching"] = strconv.FormatBool(*c.EmailSettings.EnableEmailBatching)
props["EmailNotificationContentsType"] = *c.EmailSettings.EmailNotificationContentsType props["EmailNotificationContentsType"] = *c.EmailSettings.EmailNotificationContentsType
props["EmailLoginButtonColor"] = *c.EmailSettings.LoginButtonColor
props["EmailLoginButtonBorderColor"] = *c.EmailSettings.LoginButtonBorderColor
props["EmailLoginButtonTextColor"] = *c.EmailSettings.LoginButtonTextColor
props["EnableSignUpWithGitLab"] = strconv.FormatBool(c.GitLabSettings.Enable) props["EnableSignUpWithGitLab"] = strconv.FormatBool(c.GitLabSettings.Enable)
props["ShowEmailAddress"] = strconv.FormatBool(c.PrivacySettings.ShowEmailAddress) props["ShowEmailAddress"] = strconv.FormatBool(c.PrivacySettings.ShowEmailAddress)
@@ -562,6 +566,9 @@ func getClientConfig(c *model.Config) map[string]string {
props["LdapNicknameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.NicknameAttribute != "") props["LdapNicknameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.NicknameAttribute != "")
props["LdapFirstNameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.FirstNameAttribute != "") props["LdapFirstNameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.FirstNameAttribute != "")
props["LdapLastNameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.LastNameAttribute != "") props["LdapLastNameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.LastNameAttribute != "")
props["LdapLoginButtonColor"] = *c.LdapSettings.LoginButtonColor
props["LdapLoginButtonBorderColor"] = *c.LdapSettings.LoginButtonBorderColor
props["LdapLoginButtonTextColor"] = *c.LdapSettings.LoginButtonTextColor
} }
if *License.Features.MFA { if *License.Features.MFA {
@@ -579,6 +586,9 @@ func getClientConfig(c *model.Config) map[string]string {
props["SamlFirstNameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.FirstNameAttribute != "") props["SamlFirstNameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.FirstNameAttribute != "")
props["SamlLastNameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.LastNameAttribute != "") props["SamlLastNameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.LastNameAttribute != "")
props["SamlNicknameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.NicknameAttribute != "") props["SamlNicknameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.NicknameAttribute != "")
props["SamlLoginButtonColor"] = *c.SamlSettings.LoginButtonColor
props["SamlLoginButtonBorderColor"] = *c.SamlSettings.LoginButtonBorderColor
props["SamlLoginButtonTextColor"] = *c.SamlSettings.LoginButtonTextColor
} }
if *License.Features.Cluster { if *License.Features.Cluster {