Merge pull request #1946 from isocolsky/prevent_multijoin
returning error when allet already exists in profile
This commit is contained in:
commit
db429a3dc5
4 changed files with 16 additions and 2 deletions
|
|
@ -130,6 +130,8 @@ angular.module('copayApp.controllers').controller('JoinController',
|
|||
notification.error('Fatal error connecting to Insight server');
|
||||
else if (err === 'walletFull')
|
||||
notification.error('The wallet is full');
|
||||
else if (err === 'walletAlreadyExists')
|
||||
notification.error('Wallet already exists', 'Cannot join again from the same profile');
|
||||
else if (err === 'badNetwork')
|
||||
notification.error('Network Error', 'Wallet network configuration missmatch');
|
||||
else if (err === 'badSecret')
|
||||
|
|
@ -138,6 +140,7 @@ angular.module('copayApp.controllers').controller('JoinController',
|
|||
notification.error('Error', err.message || err);
|
||||
}
|
||||
}
|
||||
$timeout(function () { $scope.$digest(); }, 1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -575,6 +575,13 @@ Identity.prototype.createWallet = function(opts, cb) {
|
|||
|
||||
var self = this;
|
||||
var w = new walletClass(opts);
|
||||
|
||||
console.log(_.keys(self.wallets));
|
||||
console.log(w.getId());
|
||||
if (_.contains(_.keys(self.wallets), w.getId())) {
|
||||
return cb('walletAlreadyExists');
|
||||
}
|
||||
|
||||
self.wallets[w.getId()] = w;
|
||||
self.updateFocusedTimestamp(w.getId());
|
||||
self.bindWallet(w);
|
||||
|
|
|
|||
|
|
@ -2550,7 +2550,10 @@ Wallet.prototype.isComplete = function() {
|
|||
* @param {string} version - the new version for the wallet
|
||||
*/
|
||||
Wallet.prototype.setVersion = function(version) {
|
||||
this.version = this.opts.version = version;
|
||||
this.version = version;
|
||||
if (this.opts) {
|
||||
this.opts.version = version;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -77,9 +77,10 @@ describe('Identity model', function() {
|
|||
return params;
|
||||
}
|
||||
|
||||
var wid = 0;
|
||||
function getNewWallet(args) {
|
||||
var w = sinon.stub();
|
||||
w.getId = sinon.stub().returns('wid');
|
||||
w.getId = sinon.stub().returns('wid' + (++wid));
|
||||
w.getStorageKey = sinon.stub().returns('wkey');
|
||||
w.toObj = sinon.stub().returns({
|
||||
obj: 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue