try {
sha = MessageDigest.getInstance("SHA");
} catch (Exception ex){
Log.error(I18N.gettext("main.loginstatus.Could_not_login_with_SHA"));
//TODO remove lowercase if filetransfer bug fixed
output.send(new InfoQuery(null,"set",authenticationId,new IQAuth(loginInfo.getUsername().toLowerCase(),loginInfo.getPassword() ,loginInfo.getResource())));
return;
}
sha.update(connectionID.getBytes());
String digest = Utils.toString(sha.digest(loginInfo.getPassword().getBytes()));
IQAuthBuilder iqab = new IQAuthBuilder();
iqab.digest = digest;
// TODO remove lowercase if filetransfer bug fixed
iqab.username = loginInfo.getUsername().toLowerCase();
iqab.resource = loginInfo.getResource();
output.send(new InfoQuery(null,"set",authenticationId,(IQExtension)iqab.build()));
}
else
{
if(!loginInfo.isSSl())
{
int option = JOptionPane.showConfirmDialog(null,
I18N.gettext("main.loginstatus.Sending_password_as_plain_text_over_an_unencrypted_connection,_continue?"),"Plain text",JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.NO_OPTION)
{
sendLoginError("Sending password in plain not allowed");
return;
}
}
// TODO remove lowercase if filetransfer bug fixed
output.send(new InfoQuery(null,"set",authenticationId,new IQAuth(loginInfo.getUsername().toLowerCase(),loginInfo.getPassword() ,loginInfo.getResource())));
}
}
}