diff options
author | David Lu <david.lu@hotmail.com> | 2016-07-14 15:57:59 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-07-14 11:57:59 -0800 |
commit | 23d831d341b7ab566f47cd09cb6bba3ecb7d3dbe (patch) | |
tree | 0099aeb3204eb02daca35e8d1b7335ee3314d6b2 /model | |
parent | bd12520b445ecf00edad139c5e78df973b0c6b06 (diff) | |
download | chat-23d831d341b7ab566f47cd09cb6bba3ecb7d3dbe.tar.gz chat-23d831d341b7ab566f47cd09cb6bba3ecb7d3dbe.tar.bz2 chat-23d831d341b7ab566f47cd09cb6bba3ecb7d3dbe.zip |
added field name to ldap system console errors (#3593)
Diffstat (limited to 'model')
-rw-r--r-- | model/config.go | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/model/config.go b/model/config.go index 64396b65e..532584a1a 100644 --- a/model/config.go +++ b/model/config.go @@ -895,16 +895,40 @@ func (o *Config) IsValid() *AppError { } if *o.LdapSettings.Enable { - if *o.LdapSettings.LdapServer == "" || - *o.LdapSettings.BaseDN == "" || - *o.LdapSettings.BindUsername == "" || - *o.LdapSettings.BindPassword == "" || - *o.LdapSettings.FirstNameAttribute == "" || - *o.LdapSettings.LastNameAttribute == "" || - *o.LdapSettings.EmailAttribute == "" || - *o.LdapSettings.UsernameAttribute == "" || - *o.LdapSettings.IdAttribute == "" { - return NewLocAppError("Config.IsValid", "Required LDAP field missing", nil, "") + if *o.LdapSettings.LdapServer == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_server", nil, "") + } + + if *o.LdapSettings.BaseDN == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_basedn", nil, "") + } + + if *o.LdapSettings.BindUsername == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_bind_username", nil, "") + } + + if *o.LdapSettings.BindPassword == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_bind_password", nil, "") + } + + if *o.LdapSettings.FirstNameAttribute == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_firstname", nil, "") + } + + if *o.LdapSettings.LastNameAttribute == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_lastname", nil, "") + } + + if *o.LdapSettings.EmailAttribute == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_email", nil, "") + } + + if *o.LdapSettings.UsernameAttribute == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_username", nil, "") + } + + if *o.LdapSettings.IdAttribute == "" { + return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_id", nil, "") } } |