diff --git a/app/src/main/java/io/xpipe/app/util/AskpassAlert.java b/app/src/main/java/io/xpipe/app/util/AskpassAlert.java index ce6b3ca62..229420fff 100644 --- a/app/src/main/java/io/xpipe/app/util/AskpassAlert.java +++ b/app/src/main/java/io/xpipe/app/util/AskpassAlert.java @@ -8,6 +8,10 @@ import javafx.animation.AnimationTimer; import javafx.application.Platform; import javafx.beans.property.SimpleObjectProperty; import javafx.scene.control.Alert; +import javafx.scene.control.Button; +import javafx.scene.control.ButtonBar; +import javafx.scene.control.ButtonType; +import javafx.scene.input.MouseEvent; import javafx.scene.layout.StackPane; import javafx.stage.Stage; @@ -20,6 +24,17 @@ public class AskpassAlert { alert.setHeaderText(prompt); alert.setAlertType(Alert.AlertType.CONFIRMATION); + // Link to help page for double prompt + if (!SecretManager.shouldCacheForPrompt(prompt)) { + var type = new ButtonType("Help", ButtonBar.ButtonData.HELP); + alert.getButtonTypes().add(type); + var button = (Button)alert.getDialogPane().lookupButton(type); + button.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> { + Hyperlinks.open(Hyperlinks.DOUBLE_PROMPT); + event.consume(); + }); + } + var text = new SecretFieldComp(prop).createStructure().get(); alert.getDialogPane().setContent(new StackPane(text)); var stage = (Stage) alert.getDialogPane().getScene().getWindow(); diff --git a/app/src/main/java/io/xpipe/app/util/Hyperlinks.java b/app/src/main/java/io/xpipe/app/util/Hyperlinks.java index 2ed387ac3..37b66fcb1 100644 --- a/app/src/main/java/io/xpipe/app/util/Hyperlinks.java +++ b/app/src/main/java/io/xpipe/app/util/Hyperlinks.java @@ -4,6 +4,7 @@ import io.xpipe.app.issue.ErrorEvent; public class Hyperlinks { + public static final String DOUBLE_PROMPT = "https://docs.xpipe.io/two-step-connections"; public static final String GITHUB = "https://github.com/xpipe-io/xpipe"; public static final String PRIVACY = "https://docs.xpipe.io/privacy-policy"; public static final String EULA = "https://docs.xpipe.io/end-user-license-agreement";