mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
require non-empty password on encrypted wallet load, avoid re-requesting passphrase on bip39 wallet import, show empty passphrases as no passphrase
This commit is contained in:
parent
ba9aed5395
commit
9022438397
3 changed files with 3 additions and 3 deletions
|
@ -1035,7 +1035,7 @@ public class AppController implements Initializable {
|
||||||
Wallet copy = wallet.copy();
|
Wallet copy = wallet.copy();
|
||||||
for(int i = 0; i < copy.getKeystores().size(); i++) {
|
for(int i = 0; i < copy.getKeystores().size(); i++) {
|
||||||
Keystore copyKeystore = copy.getKeystores().get(i);
|
Keystore copyKeystore = copy.getKeystores().get(i);
|
||||||
if(copyKeystore.hasSeed()) {
|
if(copyKeystore.hasSeed() && copyKeystore.getSeed().getPassphrase() == null) {
|
||||||
if(copyKeystore.getSeed().needsPassphrase()) {
|
if(copyKeystore.getSeed().needsPassphrase()) {
|
||||||
if(!wallet.isMasterWallet() && wallet.getMasterWallet().getKeystores().size() == copy.getKeystores().size() && wallet.getMasterWallet().getKeystores().get(i).hasSeed()) {
|
if(!wallet.isMasterWallet() && wallet.getMasterWallet().getKeystores().size() == copy.getKeystores().size() && wallet.getMasterWallet().getKeystores().get(i).hasSeed()) {
|
||||||
copyKeystore.getSeed().setPassphrase(wallet.getMasterWallet().getKeystores().get(i).getSeed().getPassphrase());
|
copyKeystore.getSeed().setPassphrase(wallet.getMasterWallet().getKeystores().get(i).getSeed().getPassphrase());
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class MnemonicKeystoreDisplayPane extends MnemonicKeystorePane {
|
public class MnemonicKeystoreDisplayPane extends MnemonicKeystorePane {
|
||||||
public MnemonicKeystoreDisplayPane(Keystore keystore) {
|
public MnemonicKeystoreDisplayPane(Keystore keystore) {
|
||||||
super(keystore.getSeed().getType().getName(), keystore.getSeed().needsPassphrase() ? "Passphrase entered" : "No passphrase", "", "image/" + WalletModel.SEED.getType() + ".png");
|
super(keystore.getSeed().getType().getName(), keystore.getSeed().needsPassphrase() && (keystore.getSeed().getPassphrase() == null || keystore.getSeed().getPassphrase().length() > 0) ? "Passphrase entered" : "No passphrase", "", "image/" + WalletModel.SEED.getType() + ".png");
|
||||||
showHideLink.setVisible(false);
|
showHideLink.setVisible(false);
|
||||||
buttonBox.getChildren().clear();
|
buttonBox.getChildren().clear();
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class WalletPasswordDialog extends Dialog<SecureString> {
|
||||||
dialogPane.getButtonTypes().addAll(okButtonType);
|
dialogPane.getButtonTypes().addAll(okButtonType);
|
||||||
Button okButton = (Button) dialogPane.lookupButton(okButtonType);
|
Button okButton = (Button) dialogPane.lookupButton(okButtonType);
|
||||||
okButton.setPrefWidth(130);
|
okButton.setPrefWidth(130);
|
||||||
BooleanBinding isInvalid = Bindings.createBooleanBinding(() -> passwordConfirm.isVisible() && !password.getText().equals(passwordConfirm.getText()), password.textProperty(), passwordConfirm.textProperty());
|
BooleanBinding isInvalid = Bindings.createBooleanBinding(() -> (requirement == PasswordRequirement.LOAD && password.getText().isEmpty()) || (passwordConfirm.isVisible() && !password.getText().equals(passwordConfirm.getText())), password.textProperty(), passwordConfirm.textProperty());
|
||||||
okButton.disableProperty().bind(isInvalid);
|
okButton.disableProperty().bind(isInvalid);
|
||||||
|
|
||||||
if(requirement != PasswordRequirement.UPDATE_NEW && requirement != PasswordRequirement.UPDATE_CHANGE) {
|
if(requirement != PasswordRequirement.UPDATE_NEW && requirement != PasswordRequirement.UPDATE_CHANGE) {
|
||||||
|
|
Loading…
Reference in a new issue