From 1d726860d8eb2f642d984089c6d449bf78df5dee Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 Jun 2015 10:40:10 +1200 Subject: Implement password change --- src/org/traccar/database/DataManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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(); } -- cgit v1.2.3