diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-11-14 21:30:47 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-14 21:30:47 +1300 |
commit | e48863c91dd049315e5ad336e5950e911cac5495 (patch) | |
tree | 100686934cb7f44febb9ca5d21d71db5fd7383be /src/org/traccar/database/DataManager.java | |
parent | e6e762c1c9416cf52421d0b26dbd38f2b70e2c3f (diff) | |
parent | e0f16f7f797a3ce1bfae3be2625690ad4b048240 (diff) | |
download | trackermap-server-e48863c91dd049315e5ad336e5950e911cac5495.tar.gz trackermap-server-e48863c91dd049315e5ad336e5950e911cac5495.tar.bz2 trackermap-server-e48863c91dd049315e5ad336e5950e911cac5495.zip |
Merge pull request #3638 from Abyss777/ldap_improve
Improve LDAP
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index f71e3e538..abc424ff9 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -76,9 +76,13 @@ public class DataManager { private boolean generateQueries; + private boolean forceLdap; + public DataManager(Config config) throws Exception { this.config = config; + forceLdap = config.getBoolean("ldap.force"); + initDatabase(); initDatabaseSchema(); } @@ -304,15 +308,12 @@ public class DataManager { LdapProvider ldapProvider = Context.getLdapProvider(); if (user != null) { if (ldapProvider != null && ldapProvider.login(user.getLogin(), password) - || user.isPasswordValid(password)) { + || !forceLdap && user.isPasswordValid(password)) { return user; } } else { if (ldapProvider != null && ldapProvider.login(email, password)) { - user = new User(); - user.setName(email); - user.setEmail(email); - user.setLogin(email); + user = ldapProvider.getUser(email); Context.getUsersManager().addItem(user); return user; } |