//Encode old password and compare it to sended one, send packet to determine changed or not.
try
{
if(!LoginController.DEFAULT_CRYPT.compare(oldPass, dbPassword))
{
ChangePasswordResponse cp1;
cp1 = new ChangePasswordResponse(accname, false);
sendPacket(cp1);
}
else
{
statement = con.prepareStatement("UPDATE accounts SET password = ? WHERE login = ?");
statement.setString(1, LoginController.DEFAULT_CRYPT.encrypt(newPass));
statement.setString(2, accname);
int result = statement.executeUpdate();
L2LoginClient client = LoginController.getInstance().getAuthedClient(accname);
if(result != 0)
{
Log.add("<acc=\"" + accname + "\" old=\"" + oldPass + "\" new=\"" + newPass + "\" ip=\"" + (client != null ? client.getIpAddress() : "0.0.0.0") + "\" />", "passwords");
}
ChangePasswordResponse cp1;
cp1 = new ChangePasswordResponse(accname, result != 0);
sendPacket(cp1);
}
}
catch(Exception e1)
{