Merge pull request #3171 from matiu/bug/fix-ja-mnemonics

add normalization of seeds, better JA support
This commit is contained in:
Gustavo Maximiliano Cortez 2015-09-16 09:44:32 -03:00
commit 6b3063793d
8 changed files with 45 additions and 71 deletions

View file

@ -27,7 +27,7 @@ angular.module('copayApp.controllers').controller('wordsController',
var words = fc.getMnemonic();
if (words)
this.mnemonicWords = words.split(' ');
this.mnemonicWords = words.split(/[\u3000\s]+/);
this.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
});

View file

@ -159,18 +159,13 @@ angular.module('copayApp.controllers').controller('importController',
if (!words) {
this.error = gettext('Please enter the seed words');
} else if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
} else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) {
return _importExtendedPrivateKey(words)
} else {
var wordList = words.split(/ /).filter(function(v) {
return v.length > 0;
});
var wordList = words.split(/[\u3000\s]+/);
// m/ allows to enter a custom derivation
if ((wordList.length % 3) != 0 && wordList[0].indexOf('m/') != 0)
if ((wordList.length % 3) != 0)
this.error = gettext('Wrong number of seed words:') + wordList.length;
else
words = wordList.join(' ');
}
if (this.error) {