aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-06 10:40:10 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-06 10:40:10 +1200
commit1d726860d8eb2f642d984089c6d449bf78df5dee (patch)
tree627089bb52869f571d5bd73a4e1913c23c6d1aac
parent3d0504935023e9b61e082e308ebd74074ed0f3b8 (diff)
downloadtraccar-server-1d726860d8eb2f642d984089c6d449bf78df5dee.tar.gz
traccar-server-1d726860d8eb2f642d984089c6d449bf78df5dee.tar.bz2
traccar-server-1d726860d8eb2f642d984089c6d449bf78df5dee.zip
Implement password change
-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();
}