mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-20 03:31:27 +00:00
Updated password and recovery key instructions
This commit is contained in:
@@ -3,26 +3,83 @@ package org.cryptomator.ui.addvaultwizard;
|
||||
import dagger.Lazy;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.print.PageLayout;
|
||||
import javafx.print.PrintQuality;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontSmoothingType;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextFlow;
|
||||
import javafx.stage.Stage;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.common.FxmlFile;
|
||||
import org.cryptomator.ui.common.FxmlScene;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
public class CreateNewVaultRecoveryKeyController implements FxController {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CreateNewVaultRecoveryKeyController.class);
|
||||
|
||||
private final Stage window;
|
||||
private final Lazy<Scene> successScene;
|
||||
private final StringProperty recoveryKeyProperty;
|
||||
private final StringProperty vaultName;
|
||||
public TextArea textarea;
|
||||
|
||||
@Inject
|
||||
CreateNewVaultRecoveryKeyController(@AddVaultWizardWindow Stage window, @FxmlScene(FxmlFile.ADDVAULT_SUCCESS) Lazy<Scene> successScene, @Named("recoveryKey")StringProperty recoveryKey) {
|
||||
CreateNewVaultRecoveryKeyController(@AddVaultWizardWindow Stage window, @FxmlScene(FxmlFile.ADDVAULT_SUCCESS) Lazy<Scene> successScene, @Named("recoveryKey") StringProperty recoveryKey, @Named("vaultName") StringProperty vaultName) {
|
||||
this.window = window;
|
||||
this.successScene = successScene;
|
||||
this.recoveryKeyProperty = recoveryKey;
|
||||
this.vaultName = vaultName;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void printRecoveryKey() {
|
||||
// TODO localize
|
||||
PrinterJob job = PrinterJob.createPrinterJob();
|
||||
if (job != null && job.showPrintDialog(window)) {
|
||||
PageLayout pageLayout = job.getJobSettings().getPageLayout();
|
||||
|
||||
Text heading = new Text("Cryptomator Recovery Key\n" + vaultName.get() + "\n");
|
||||
heading.setFont(Font.font("serif", FontWeight.BOLD, 20));
|
||||
heading.setFontSmoothingType(FontSmoothingType.LCD);
|
||||
|
||||
Text key = new Text(recoveryKeyProperty.get());
|
||||
key.setFont(Font.font("serif", FontWeight.NORMAL, 16));
|
||||
key.setFontSmoothingType(FontSmoothingType.GRAY);
|
||||
|
||||
TextFlow textFlow = new TextFlow();
|
||||
textFlow.setPrefSize(pageLayout.getPrintableWidth(), pageLayout.getPrintableHeight());
|
||||
textFlow.getChildren().addAll(heading, key);
|
||||
textFlow.setLineSpacing(6);
|
||||
|
||||
if (job.printPage(textFlow)) {
|
||||
LOG.info("Recovery key printed.");
|
||||
job.endJob();
|
||||
} else {
|
||||
LOG.warn("Printing recovery key failed.");
|
||||
}
|
||||
} else {
|
||||
LOG.info("Printing recovery key canceled by user.");
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void copyRecoveryKey() {
|
||||
ClipboardContent clipboardContent = new ClipboardContent();
|
||||
clipboardContent.putString(recoveryKeyProperty.get());
|
||||
Clipboard.getSystemClipboard().setContent(clipboardContent);
|
||||
LOG.info("Recovery key copied to clipboard.");
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
<VBox spacing="6">
|
||||
<Label text="You can not reset your password. Make sure to remember it well! If you lose the password, the last resort will be a recovery key." wrapText="true"/>
|
||||
<RadioButton fx:id="showRecoveryKey" toggleGroup="${recoveryKeyChoice}" text="Then better show me the recovery key" />
|
||||
<RadioButton fx:id="skipRecoveryKey" toggleGroup="${recoveryKeyChoice}" text="No thanks, I will not lose my password" />
|
||||
<Label text="%addvaultwizard.new.generateRecoveryKeyChoice" wrapText="true"/>
|
||||
<RadioButton fx:id="showRecoveryKey" toggleGroup="${recoveryKeyChoice}" text="%addvaultwizard.new.generateRecoveryKeyChoice.yes" />
|
||||
<RadioButton fx:id="skipRecoveryKey" toggleGroup="${recoveryKeyChoice}" text="%addvaultwizard.new.generateRecoveryKeyChoice.no" />
|
||||
</VBox>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ButtonBar?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
@@ -23,15 +22,24 @@
|
||||
|
||||
<Label text="%addvaultwizard.new.recoveryKeyInstruction" wrapText="true"/>
|
||||
|
||||
<TextArea editable="false" text="${controller.recoveryKey}" wrapText="true" prefRowCount="6"/>
|
||||
<TextArea editable="false" text="${controller.recoveryKey}" wrapText="true" prefRowCount="4" fx:id="textarea"/>
|
||||
|
||||
<CheckBox fx:id="finalConfirmationCheckbox" text="%addvaultwizard.new.recoveryKeySavedCheckbox" wrapText="true"/>
|
||||
<ButtonBar buttonMinWidth="120" buttonOrder="+R">
|
||||
<buttons>
|
||||
<Button text="TODO Print" ButtonBar.buttonData="RIGHT" onAction="#printRecoveryKey"/>
|
||||
<Button text="TODO Copy" ButtonBar.buttonData="RIGHT" onAction="#copyRecoveryKey"/>
|
||||
</buttons>
|
||||
</ButtonBar>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
<Label text="%addvaultwizard.new.recoveryKeyStorageHints" wrapText="true"/>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
<ButtonBar buttonMinWidth="120" buttonOrder="+X">
|
||||
<buttons>
|
||||
<Button text="%generic.button.next" ButtonBar.buttonData="NEXT_FORWARD" onAction="#next" defaultButton="true" disable="${!finalConfirmationCheckbox.selected}"/>
|
||||
<Button text="%generic.button.next" ButtonBar.buttonData="NEXT_FORWARD" onAction="#next" defaultButton="true"/>
|
||||
</buttons>
|
||||
</ButtonBar>
|
||||
</children>
|
||||
|
||||
@@ -43,9 +43,12 @@ addvaultwizard.new.reenterPassword=Confirm the password
|
||||
addvaultwizard.new.passwordsMatch=Passwords match!
|
||||
addvaultwizard.new.passwordsDoNotMatch=Passwords do not match
|
||||
addvaultwizard.new.createVaultBtn=Create Vault
|
||||
addvaultwizard.new.generateRecoveryKeyChoice=You won't be able to access your data without your password. Do you want a recovery key for the case you lose your password?
|
||||
addvaultwizard.new.generateRecoveryKeyChoice.yes=Yes please, better safe than sorry
|
||||
addvaultwizard.new.generateRecoveryKeyChoice.no=No thanks, I will not lose my password
|
||||
### Recovery Key
|
||||
addvaultwizard.new.recoveryKeyInstruction=This is your recovery key. Keep it safe, it is your only chance to recover your data if you lose your password.
|
||||
addvaultwizard.new.recoveryKeySavedCheckbox=Yes, I've made a secure backup of this recovery key
|
||||
addvaultwizard.new.recoveryKeyInstruction=Wise choice! The following recovery key can be used to restore access to your data:
|
||||
addvaultwizard.new.recoveryKeyStorageHints=Keep it somewhere very secure, e.g.:\n • Store it using a password manager\n • Save it on a USB flash drive\n • Print it on paper
|
||||
### Information
|
||||
addvault.new.readme.storageLocation.fileName=WHAT IS THIS DIRECTORY.rtf
|
||||
addvault.new.readme.storageLocation.1=\\fs40\\qc ⚠️ VAULT FILES ⚠️
|
||||
|
||||
Reference in New Issue
Block a user