Merge pull request #391 from sachaaaaa/show_seed_errors
Report mnemonic errors instead of silent failure
This commit is contained in:
commit
a7f999aeb1
|
@ -579,6 +579,7 @@
|
|||
<div class='standalone-mnemonic-inputs'>
|
||||
<input class='form-control' type='text' id='mnemonic' placeholder='Mnemonic Seed' autocomplete='off' spellcheck='false' />
|
||||
</div>
|
||||
<div id='error' class='collapse'></div>
|
||||
<div class='restore standalone-register-language'>
|
||||
<span>Language:</span>
|
||||
<div class='select-container'>
|
||||
|
@ -586,7 +587,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<a class='button' id='register-mnemonic'>Restore</a>
|
||||
<div id='error' class='collapse'></div>
|
||||
<div id=status></div>
|
||||
</div>
|
||||
<h4 class='section-toggle section-toggle-visible'>Register a new account</h4>
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
async register(mnemonic, language) {
|
||||
// Make sure the password is valid
|
||||
if (this.validatePassword()) {
|
||||
this.showToast('Invalid password');
|
||||
this.showToast(i18n('invalidPassword'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,16 @@
|
|||
registerWithMnemonic() {
|
||||
const mnemonic = this.$('#mnemonic').val();
|
||||
const language = this.$('#mnemonic-language').val();
|
||||
try {
|
||||
window.mnemonic.mn_decode(mnemonic, language);
|
||||
} catch (error) {
|
||||
this.$('#mnemonic').addClass('error-input');
|
||||
this.$('#error').text(error);
|
||||
this.$('#error').show();
|
||||
return;
|
||||
}
|
||||
this.$('#error').hide();
|
||||
this.$('#mnemonic').removeClass('error-input');
|
||||
if (!mnemonic) {
|
||||
this.log('Please provide a mnemonic word list');
|
||||
} else {
|
||||
|
@ -155,11 +165,7 @@
|
|||
onCopyMnemonic() {
|
||||
window.clipboard.writeText(this.$('#mnemonic-display').text());
|
||||
|
||||
const toast = new Whisper.MessageToastView({
|
||||
message: i18n('copiedMnemonic'),
|
||||
});
|
||||
toast.$el.appendTo(this.$el);
|
||||
toast.render();
|
||||
this.showToast(i18n('copiedMnemonic'));
|
||||
},
|
||||
log(s) {
|
||||
window.log.info(s);
|
||||
|
|
|
@ -141,7 +141,7 @@ function mn_decode(str, wordset_name) {
|
|||
checksum_word.slice(0, wordset.prefix_len)
|
||||
) {
|
||||
throw new MnemonicError(
|
||||
'Your private key could not be verified, please try again'
|
||||
'Your private key could not be verified, please verify the checksum word'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -806,7 +806,8 @@ $loading-height: 16px;
|
|||
}
|
||||
}
|
||||
|
||||
.password-inputs {
|
||||
.password-inputs,
|
||||
.standalone-mnemonic-inputs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
|
Loading…
Reference in New Issue