diff options
Diffstat (limited to 'src/main/java/org/traccar/database/DeviceManager.java')
-rw-r--r-- | src/main/java/org/traccar/database/DeviceManager.java | 11 |
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..51f35b3db 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); if (password != null) { return password; } + if (protocol != null) { + password = Context.getConfig().getString(protocol + "." + Command.KEY_DEVICE_PASSWORD); + if (password != null) { + return password; + } + } + return defaultPassword; } |