aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-16 08:03:57 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-16 08:03:57 -0700
commit159f0ef4861b64085cdd1c1d8d0234f47bc75797 (patch)
tree6ce503918031c82db88ae2bb8019861a4f7468cf /src
parent16e63283a2b64b2e1b490701c219beed653f2b17 (diff)
downloadtrackermap-server-159f0ef4861b64085cdd1c1d8d0234f47bc75797.tar.gz
trackermap-server-159f0ef4861b64085cdd1c1d8d0234f47bc75797.tar.bz2
trackermap-server-159f0ef4861b64085cdd1c1d8d0234f47bc75797.zip
Update only if password changed
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/api/BaseObjectResource.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/BaseObjectResource.java b/src/main/java/org/traccar/api/BaseObjectResource.java
index 408594315..0ec2bfeaa 100644
--- a/src/main/java/org/traccar/api/BaseObjectResource.java
+++ b/src/main/java/org/traccar/api/BaseObjectResource.java
@@ -99,8 +99,11 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
new Columns.Exclude("id"),
new Condition.Equals("id", "id")));
if (entity instanceof User) {
- storage.updateObject(entity, new Request(
- new Columns.Include("hashedPassword", "salt"), new Condition.Equals("id", "id")));
+ User user = (User) entity;
+ if (user.getHashedPassword() != null) {
+ storage.updateObject(entity, new Request(
+ new Columns.Include("hashedPassword", "salt"), new Condition.Equals("id", "id")));
+ }
}
cacheManager.updateOrInvalidate(true, entity);
LogAction.edit(getUserId(), entity);