aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database/DeviceManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/database/DeviceManager.java')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index d5b1c8c0d..fa95adeb2 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -116,13 +116,20 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
}
@Override
- public String getDevicePassword(long id, String defaultPassword) {
+ public String getDevicePassword(long id, String protocol, String defaultPassword) {
- String password = getById(id).getString(Command.KEY_DEVICE_PASSWORD);
+ String password = lookupAttributeString(id, Command.KEY_DEVICE_PASSWORD, null, false, false);
if (password != null) {
return password;
}
+ if (protocol != null) {
+ password = Context.getConfig().getString(protocol + "." + Command.KEY_DEVICE_PASSWORD);
+ if (password != null) {
+ return password;
+ }
+ }
+
return defaultPassword;
}