aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-11-14 12:44:59 +0500
committerAbyss777 <abyss@fox5.ru>2017-11-14 12:44:59 +0500
commite0f16f7f797a3ce1bfae3be2625690ad4b048240 (patch)
tree8f3d464afc02df1a67a28c43cd1b4aaf89e92fb7 /src/org/traccar/database/DataManager.java
parent0a8f30a572b1e64ff3e1d67281bf9fa3f40b9ccb (diff)
downloadtrackermap-server-e0f16f7f797a3ce1bfae3be2625690ad4b048240.tar.gz
trackermap-server-e0f16f7f797a3ce1bfae3be2625690ad4b048240.tar.bz2
trackermap-server-e0f16f7f797a3ce1bfae3be2625690ad4b048240.zip
Improve LDAP
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r--src/org/traccar/database/DataManager.java11
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;
}