Commit 12d9ae8c authored by Gabriel Guardincerri's avatar Gabriel Guardincerri Committed by gguardin

Bug Fix. Now the page saves always the plain password.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9314 b35dd754-fafc-0310-a699-88a17e54d16e
parent f9bc6050
...@@ -49,12 +49,17 @@ ...@@ -49,12 +49,17 @@
service.setPort(25); service.setPort(25);
} }
service.setUsername(username); service.setUsername(username);
// Get hash values of existing password and new one // Get hash value of existing password
String existingHashPassword = ""; String existingHashPassword = "";
String newHashPassword = "";
if (service.getPassword() != null) { if (service.getPassword() != null) {
existingHashPassword = StringUtils.hash(service.getPassword()); existingHashPassword = StringUtils.hash(service.getPassword());
} }
// Check if the new password was changed. If it wasn't changed, then it is the original hashed password
// NOTE: if the new PLAIN password equals the previous HASHED password this fails, but is unlikely.
if (!existingHashPassword.equals(password)) {
// Hash the new password since it was changed
String newHashPassword = "";
if (password != null) { if (password != null) {
newHashPassword = StringUtils.hash(password); newHashPassword = StringUtils.hash(password);
} }
...@@ -62,6 +67,8 @@ ...@@ -62,6 +67,8 @@
if (!existingHashPassword.equals(newHashPassword)) { if (!existingHashPassword.equals(newHashPassword)) {
service.setPassword(password); service.setPassword(password);
} }
}
service.setDebugEnabled(debug); service.setDebugEnabled(debug);
service.setSSLEnabled(ssl); service.setSSLEnabled(ssl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment