Link to help page for double prompt

This commit is contained in:
crschnick 2024-03-02 09:01:55 +00:00
parent 97d7f4f30f
commit 106132ef88
2 changed files with 16 additions and 0 deletions

View file

@ -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();

View file

@ -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";