Skip to content

Commit ec73bd7

Browse files
committed
updated auth dialog
1 parent bd50e98 commit ec73bd7

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/main/java/com/esri/samples/portal/oauth/AuthenticationDialog.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,20 @@ class AuthenticationDialog extends Dialog<OAuthConfiguration> {
5555
}
5656

5757
setResultConverter(dialogButton -> {
58-
if (!portalURL.getText().equals("") && !clientID.getText().equals("") && !redirectURI.getText().equals("")) {
59-
try {
60-
return dialogButton == continueButton ? new OAuthConfiguration(portalURL.getText(), clientID.getText(),
61-
redirectURI.getText()) : null;
62-
} catch (Exception e) {
58+
if (dialogButton == continueButton) {
59+
if (!portalURL.getText().equals("") && !clientID.getText().equals("") && !redirectURI.getText().equals("")) {
60+
try {
61+
return new OAuthConfiguration(portalURL.getText(), clientID.getText(), redirectURI.getText());
62+
} catch (Exception e) {
63+
Alert alert = new Alert(Alert.AlertType.ERROR);
64+
alert.setContentText(e.getMessage());
65+
alert.show();
66+
}
67+
} else {
6368
Alert alert = new Alert(Alert.AlertType.ERROR);
64-
alert.setContentText(e.getMessage());
69+
alert.setContentText("missing credentials");
6570
alert.show();
6671
}
67-
} else {
68-
Alert alert = new Alert(Alert.AlertType.ERROR);
69-
alert.setContentText("missing credentials");
70-
alert.show();
7172
}
7273
return null;
7374
});

0 commit comments

Comments
 (0)