aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
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;
}