aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/database/DataManager.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 6cfd84d41..54f1cdc3a 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -231,7 +231,8 @@ public class DataManager {
public void updateUser(User user) throws SQLException {
QueryBuilder.create(dataSource,
- "UPDATE user SET name = :name, email = :email, admin = :admin WHERE id = :id;")
+ "UPDATE user SET name = :name, email = :email, admin = :admin," +
+ "password = CASEWHEN((SELECT password FROM user WHERE id = :id) = :password, :password, CAST(HASH('SHA256', STRINGTOUTF8(:password), 1000) AS VARCHAR)) WHERE id = :id;")
.setObject(user)
.executeUpdate();
}