summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index cbb254768..51a3b252e 100644
--- a/model/config.go
+++ b/model/config.go
@@ -486,6 +486,11 @@ func (o *Config) SetDefaults() {
*o.LdapSettings.EmailAttribute = ""
}
+ if o.LdapSettings.UsernameAttribute == nil {
+ o.LdapSettings.UsernameAttribute = new(string)
+ *o.LdapSettings.UsernameAttribute = ""
+ }
+
if o.LdapSettings.NicknameAttribute == nil {
o.LdapSettings.NicknameAttribute = new(string)
*o.LdapSettings.NicknameAttribute = ""
@@ -709,6 +714,20 @@ func (o *Config) IsValid() *AppError {
return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_sync_interval.app_error", nil, "")
}
+ 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, "")
+ }
+ }
+
return nil
}