mirror of
https://github.com/igniterealtime/Spark.git
synced 2026-08-18 02:56:24 +00:00
Hotfix to detect an issue when credentials were cleared
This commit is contained in:
@ -1043,6 +1043,14 @@ public class LoginUIPanel extends javax.swing.JPanel implements KeyListener, Foc
|
||||
// Persist information
|
||||
String username = getUsername();
|
||||
String serverName = getServerName();
|
||||
//FIXME sometimes when the auto login enabled the
|
||||
if (isBlank(username) || isBlank(serverName)) {
|
||||
Log.error("No Username or Server");
|
||||
loginDialog.setVisible(true);
|
||||
String errorMessage = "No Username or Server. Available props are " + localPref;
|
||||
MessageDialog.showErrorDialog(loginDialog, errorMessage, null);
|
||||
return;
|
||||
}
|
||||
EntityBareJid bareJid = JidCreate.entityBareFromOrNull(getBareJid());
|
||||
String password = getPassword();
|
||||
|
||||
|
||||
@ -123,6 +123,11 @@ public class LocalPreferences {
|
||||
props.remove(userPasswordProp);
|
||||
return;
|
||||
}
|
||||
// Don't save empty password, this can be a bug
|
||||
if (password.isEmpty()) {
|
||||
Log.error("The password for " + bareJid + " is empty");
|
||||
return;
|
||||
}
|
||||
String pw = Encryptor.encrypt(password);
|
||||
setString(userPasswordProp, pw);
|
||||
}
|
||||
@ -1227,4 +1232,20 @@ public class LocalPreferences {
|
||||
public int getMaxCurrentHistorySize() {
|
||||
return getInt("currentHistoryMaxSize", 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder propsText = new StringBuilder();
|
||||
for (var entry : props.entrySet()) {
|
||||
String name = entry.getKey().toString();
|
||||
String val = entry.getValue().toString();
|
||||
if (name.startsWith("password") && !name.equals("passwordSaved")) {
|
||||
if (!isBlank(val)) {
|
||||
val = "HIDDEN";
|
||||
}
|
||||
}
|
||||
propsText.append(name).append("=").append(val).append('\n');
|
||||
}
|
||||
return propsText.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user