mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-23 22:49:17 +00:00
show user friendly error on non-ascii password
This commit is contained in:
parent
d78709e1f9
commit
7243d7fa38
2 changed files with 6 additions and 2 deletions
common/src/main/java/haveno/common/crypto
desktop/src/main/java/haveno/desktop/main/account/content/password
|
@ -243,6 +243,11 @@ public class KeyStorage {
|
|||
//noinspection ResultOfMethodCallIgnored
|
||||
storageDir.mkdirs();
|
||||
|
||||
// password must be ascii
|
||||
if (password != null && !password.matches("\\p{ASCII}*")) {
|
||||
throw new IllegalArgumentException("Password must be ASCII.");
|
||||
}
|
||||
|
||||
var oldPasswordChars = oldPassword == null ? new char[0] : oldPassword.toCharArray();
|
||||
var passwordChars = password == null ? new char[0] : password.toCharArray();
|
||||
try {
|
||||
|
|
|
@ -39,7 +39,6 @@ import static haveno.desktop.util.FormBuilder.addButtonBusyAnimationLabel;
|
|||
import static haveno.desktop.util.FormBuilder.addMultilineLabel;
|
||||
import static haveno.desktop.util.FormBuilder.addPasswordTextField;
|
||||
import static haveno.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import haveno.desktop.util.Layout;
|
||||
import haveno.desktop.util.validation.PasswordValidator;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
|
@ -160,7 +159,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
|
|||
} catch (Throwable t) {
|
||||
log.error("Error applying password: {}\n", t.getMessage(), t);
|
||||
new Popup()
|
||||
.warning(Res.get("password.walletEncryptionFailed") + "\n\n" + ExceptionUtils.getStackTrace(t))
|
||||
.warning(Res.get("password.walletEncryptionFailed") + "\n\n" + t.getMessage())
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue