2nd fix to alert height

This commit is contained in:
Craig Raw 2021-05-05 14:59:53 +02:00
parent 23f3ae51db
commit 07012615ff

View file

@ -221,14 +221,14 @@ public class AppServices {
if(tlsServerException.getCause().getMessage().contains("PKIX path building failed")) { if(tlsServerException.getCause().getMessage().contains("PKIX path building failed")) {
File crtFile = Config.get().getElectrumServerCert(); File crtFile = Config.get().getElectrumServerCert();
if(crtFile != null && Config.get().getServerType() == ServerType.ELECTRUM_SERVER) { if(crtFile != null && Config.get().getServerType() == ServerType.ELECTRUM_SERVER) {
AppServices.showErrorDialog("SSL Handshake Failed", "The configured server certificate at " + crtFile.getAbsolutePath() + " did not match the certificate provided by the server at " + tlsServerException.getServer().getHost() + ". " + AppServices.showErrorDialog("SSL Handshake Failed", "The configured server certificate at " + crtFile.getAbsolutePath() + " did not match the certificate provided by the server at " + tlsServerException.getServer().getHost() + "." +
"This may indicate a man-in-the-middle attack!" + "\n\nThis may indicate a man-in-the-middle attack!" +
"\n\nChange the configured server certificate if you would like to proceed."); "\n\nChange the configured server certificate if you would like to proceed.");
} else { } else {
crtFile = Storage.getCertificateFile(tlsServerException.getServer().getHost()); crtFile = Storage.getCertificateFile(tlsServerException.getServer().getHost());
if(crtFile != null) { if(crtFile != null) {
Optional<ButtonType> optButton = AppServices.showErrorDialog("SSL Handshake Failed", "The certificate provided by the server at " + tlsServerException.getServer().getHost() + " appears to have changed. " + Optional<ButtonType> optButton = AppServices.showErrorDialog("SSL Handshake Failed", "The certificate provided by the server at " + tlsServerException.getServer().getHost() + " appears to have changed." +
"This may indicate a man-in-the-middle attack!" + "\n\nThis may indicate a man-in-the-middle attack!" +
"\n\nDo you still want to proceed?", ButtonType.NO, ButtonType.YES); "\n\nDo you still want to proceed?", ButtonType.NO, ButtonType.YES);
if(optButton.isPresent() && optButton.get() == ButtonType.YES) { if(optButton.isPresent() && optButton.get() == ButtonType.YES) {
crtFile.delete(); crtFile.delete();
@ -533,6 +533,11 @@ public class AppServices {
alert.getDialogPane().setContent(hyperlinkLabel); alert.getDialogPane().setContent(hyperlinkLabel);
} }
String[] lines = content.split("\r\n|\r|\n");
if(lines.length > 3) {
alert.getDialogPane().setPrefHeight(180 + lines.length * 20);
}
moveToActiveWindowScreen(alert); moveToActiveWindowScreen(alert);
return alert.showAndWait(); return alert.showAndWait();
} }