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,19 +49,26 @@
service.setPort(25);
}
service.setUsername(username);
// Get hash values of existing password and new one
// Get hash value of existing password
String existingHashPassword = "";
String newHashPassword = "";
if (service.getPassword() != null) {
existingHashPassword = StringUtils.hash(service.getPassword());
}
if (password != null) {
newHashPassword = StringUtils.hash(password);
}
// Change password if hash values are different
if (!existingHashPassword.equals(newHashPassword)) {
service.setPassword(password);
// 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) {
newHashPassword = StringUtils.hash(password);
}
// Change password if hash values are different
if (!existingHashPassword.equals(newHashPassword)) {
service.setPassword(password);
}
}
service.setDebugEnabled(debug);
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