Make login dialog more robust
This commit is contained in:
parent
233dd3fa9c
commit
9b39440190
|
@ -73,19 +73,23 @@ public class Cam4LoginDialog {
|
||||||
});
|
});
|
||||||
webEngine.getLoadWorker().stateProperty().addListener((observable, oldState, newState) -> {
|
webEngine.getLoadWorker().stateProperty().addListener((observable, oldState, newState) -> {
|
||||||
if (newState == State.SUCCEEDED) {
|
if (newState == State.SUCCEEDED) {
|
||||||
String username = Config.getInstance().getSettings().cam4Username;
|
|
||||||
if (username != null && !username.trim().isEmpty()) {
|
|
||||||
webEngine.executeScript("$('input[name=username]').attr('value','" + username + "')");
|
|
||||||
}
|
|
||||||
String password = Config.getInstance().getSettings().cam4Password;
|
|
||||||
if (password != null && !password.trim().isEmpty()) {
|
|
||||||
webEngine.executeScript("$('input[name=password]').attr('value','" + password + "')");
|
|
||||||
}
|
|
||||||
webEngine.executeScript("$('div[class~=navbar]').css('display','none')");
|
|
||||||
webEngine.executeScript("$('div#footer').css('display','none')");
|
|
||||||
webEngine.executeScript("$('div#content').css('padding','0')");
|
|
||||||
veil.setVisible(false);
|
veil.setVisible(false);
|
||||||
p.setVisible(false);
|
p.setVisible(false);
|
||||||
|
try {
|
||||||
|
String username = Config.getInstance().getSettings().cam4Username;
|
||||||
|
if (username != null && !username.trim().isEmpty()) {
|
||||||
|
webEngine.executeScript("$('input[name=username]').attr('value','" + username + "')");
|
||||||
|
}
|
||||||
|
String password = Config.getInstance().getSettings().cam4Password;
|
||||||
|
if (password != null && !password.trim().isEmpty()) {
|
||||||
|
webEngine.executeScript("$('input[name=password]').attr('value','" + password + "')");
|
||||||
|
}
|
||||||
|
webEngine.executeScript("$('div[class~=navbar]').css('display','none')");
|
||||||
|
webEngine.executeScript("$('div#footer').css('display','none')");
|
||||||
|
webEngine.executeScript("$('div#content').css('padding','0')");
|
||||||
|
} catch(Exception e) {
|
||||||
|
LOG.warn("Couldn't auto fill username and password for Cam4", e);
|
||||||
|
}
|
||||||
} else if (newState == State.CANCELLED || newState == State.FAILED) {
|
} else if (newState == State.CANCELLED || newState == State.FAILED) {
|
||||||
veil.setVisible(false);
|
veil.setVisible(false);
|
||||||
p.setVisible(false);
|
p.setVisible(false);
|
||||||
|
|
Loading…
Reference in New Issue