always show wallet name on password dialog

This commit is contained in:
Craig Raw 2021-03-18 11:59:59 +02:00
parent 35eb8fcdf9
commit 9166160008
6 changed files with 9 additions and 13 deletions

View file

@ -837,7 +837,7 @@ public class AppController implements Initializable {
} }
Storage storage = new Storage(Storage.getWalletFile(wallet.getName())); Storage storage = new Storage(Storage.getWalletFile(wallet.getName()));
WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.UPDATE_NEW); WalletPasswordDialog dlg = new WalletPasswordDialog(wallet.getName(), WalletPasswordDialog.PasswordRequirement.UPDATE_NEW);
Optional<SecureString> password = dlg.showAndWait(); Optional<SecureString> password = dlg.showAndWait();
if(password.isPresent()) { if(password.isPresent()) {
if(password.get().length() == 0) { if(password.get().length() == 0) {

View file

@ -93,7 +93,7 @@ public class FileWalletExportPane extends TitledDescriptionPane {
Wallet copy = wallet.copy(); Wallet copy = wallet.copy();
if(copy.isEncrypted()) { if(copy.isEncrypted()) {
WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); WalletPasswordDialog dlg = new WalletPasswordDialog(wallet.getName(), WalletPasswordDialog.PasswordRequirement.LOAD);
Optional<SecureString> password = dlg.showAndWait(); Optional<SecureString> password = dlg.showAndWait();
if(password.isPresent()) { if(password.isPresent()) {
final File walletFile = AppServices.get().getOpenWallets().get(wallet).getWalletFile(); final File walletFile = AppServices.get().getOpenWallets().get(wallet).getWalletFile();

View file

@ -308,7 +308,7 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
return; return;
} }
WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); WalletPasswordDialog dlg = new WalletPasswordDialog(wallet.getName(), WalletPasswordDialog.PasswordRequirement.LOAD);
Optional<SecureString> password = dlg.showAndWait(); Optional<SecureString> password = dlg.showAndWait();
if(password.isPresent()) { if(password.isPresent()) {
Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(wallet.copy(), password.get()); Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(wallet.copy(), password.get());

View file

@ -25,12 +25,8 @@ public class WalletPasswordDialog extends Dialog<SecureString> {
private final CheckBox deleteBackups; private final CheckBox deleteBackups;
private boolean addingPassword; private boolean addingPassword;
public WalletPasswordDialog(PasswordRequirement requirement) {
this(null, requirement);
}
public WalletPasswordDialog(String walletName, PasswordRequirement requirement) { public WalletPasswordDialog(String walletName, PasswordRequirement requirement) {
this(null, requirement, false); this(walletName, requirement, false);
} }
public WalletPasswordDialog(String walletName, PasswordRequirement requirement, boolean suggestChangePassword) { public WalletPasswordDialog(String walletName, PasswordRequirement requirement, boolean suggestChangePassword) {
@ -135,10 +131,10 @@ public class WalletPasswordDialog extends Dialog<SecureString> {
public enum PasswordRequirement { public enum PasswordRequirement {
LOAD("Please enter the wallet password:", "Unlock"), LOAD("Please enter the wallet password:", "Unlock"),
UPDATE_NEW("Add a password to the wallet?\nLeave empty for none:", "No Password"), UPDATE_NEW("Add a password to the wallet?\nLeave empty for no password:", "No Password"),
UPDATE_EMPTY("This wallet has no password.\nAdd a password to the wallet?\nLeave empty for none:", "No Password"), UPDATE_EMPTY("This wallet has no password.\nAdd a password to the wallet?\nLeave empty for no password:", "No Password"),
UPDATE_SET("Please re-enter the wallet password:", "Verify Password"), UPDATE_SET("Please re-enter the wallet password:", "Verify Password"),
UPDATE_CHANGE("Enter the new wallet password.\nLeave empty for none:", "No Password"); UPDATE_CHANGE("Enter the new wallet password.\nLeave empty for no password:", "No Password");
private final String description; private final String description;
private final String okButtonText; private final String okButtonText;

View file

@ -716,7 +716,7 @@ public class HeadersController extends TransactionFormController implements Init
File file = headersForm.getAvailableWallets().get(headersForm.getSigningWallet()).getWalletFile(); File file = headersForm.getAvailableWallets().get(headersForm.getSigningWallet()).getWalletFile();
if(copy.isEncrypted()) { if(copy.isEncrypted()) {
WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); WalletPasswordDialog dlg = new WalletPasswordDialog(copy.getName(), WalletPasswordDialog.PasswordRequirement.LOAD);
Optional<SecureString> password = dlg.showAndWait(); Optional<SecureString> password = dlg.showAndWait();
if(password.isPresent()) { if(password.isPresent()) {
Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(copy, password.get()); Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(copy, password.get());

View file

@ -338,7 +338,7 @@ public class KeystoreController extends WalletFormController implements Initiali
Wallet copy = getWalletForm().getWallet().copy(); Wallet copy = getWalletForm().getWallet().copy();
if(copy.isEncrypted()) { if(copy.isEncrypted()) {
WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); WalletPasswordDialog dlg = new WalletPasswordDialog(copy.getName(), WalletPasswordDialog.PasswordRequirement.LOAD);
Optional<SecureString> password = dlg.showAndWait(); Optional<SecureString> password = dlg.showAndWait();
if(password.isPresent()) { if(password.isPresent()) {
Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(copy, password.get()); Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(copy, password.get());