switch between wallets in profile working

This commit is contained in:
Matias Alejo Garcia 2014-10-05 15:59:41 -03:00
commit ac491d10b0
19 changed files with 293 additions and 179 deletions

View file

@ -52,22 +52,20 @@
</section> </section>
</nav> </nav>
<aside class="left-off-canvas-menu">
<div ng-include="'views/includes/sidebar-mobile.html'"></div>
</aside>
<!-- <aside class="left&#45;off&#45;canvas&#45;menu"> -->
<!-- <div ng&#45;include="'views/includes/sidebar&#45;mobile.html'"></div> -->
<!-- </aside> -->
<!-- -->
<div notifications="right top"></div> <div notifications="right top"></div>
<div <div
ng-class="{'sidebar' : $root.wallet && $root.wallet.isReady() &&
!$root.wallet.isLocked}"
ng-include="'views/includes/sidebar.html'" ng-include="'views/includes/sidebar.html'"
role='navigation' role='navigation'
ng-if="$root.wallet && $root.wallet.isReady() && class="sidebar"
!$root.wallet.isLocked"></div> ng-if="$root.iden"></div>
<section ng-class="{'main' : $root.wallet && $root.wallet.isReady() && <section ng-class="{'main' : $root.iden && $root.iden.listWallets().length>0}" ng-view></section>
!$root.wallet.isLocked}" ng-view></section>
<a class="exit-off-canvas"></a> <a class="exit-off-canvas"></a>

54
js/controllers/create.js Normal file
View file

@ -0,0 +1,54 @@
'use strict';
angular.module('copayApp.controllers').controller('CreateController',
function($scope, $rootScope, $location, $timeout, controllerUtils, backupService, notification) {
$rootScope.fromSetup = true;
$scope.loading = false;
$scope.walletPassword = $rootScope.walletPassword;
$scope.isMobile = !!window.cordova;
$scope.hideAdv = true;
$scope.networkName = config.networkName;
// ng-repeat defined number of times instead of repeating over array?
$scope.getNumber = function(num) {
return new Array(num);
}
$scope.totalCopayers = config.wallet.totalCopayers;
$scope.TCValues = _.range(1, config.limits.totalCopayers + 1);
var updateRCSelect = function(n) {
var maxReq = copay.Wallet.getMaxRequiredCopayers(n);
$scope.RCValues = _.range(1, maxReq + 1);
$scope.requiredCopayers = Math.min(parseInt(n / 2 + 1), maxReq);
};
updateRCSelect($scope.totalCopayers);
$scope.$watch('totalCopayers', function(tc) {
updateRCSelect(tc);
});
$scope.create = function(form) {
if (form && form.$invalid) {
notification.error('Error', 'Please enter the required fields');
return;
}
$scope.loading = true;
var opts = {
requiredCopayers: $scope.requiredCopayers,
totalCopayers: $scope.totalCopayers,
name: $scope.walletName,
privateKeyHex: $scope.private,
networkName: $scope.networkName,
};
$rootScope.iden.createWallet(opts, function(err, w) {
$rootScope.iden.closeWallet($rootScope.wallet.id, function() {
$scope.loading = false;
$rootScope.wallet = w;
controllerUtils.bindWallet(w, $scope);
});
});
};
});

View file

@ -13,10 +13,8 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
walletDefaults: config.wallet, walletDefaults: config.wallet,
passphrase: config.passphrase, passphrase: config.passphrase,
}, function(err, iden ,w) { }, function(err, iden ,w) {
$scope.loading = false;
$rootScope.iden = iden; $rootScope.iden = iden;
$rootScope.wallet = w; $rootScope.wallet = w;
controllerUtils.bindWallet(w, $scope); controllerUtils.bindWallet(w, $scope);
}); });
} }

View file

@ -18,7 +18,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
controllerUtils.onErrorDigest( controllerUtils.onErrorDigest(
$scope, (err.toString()||'').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error'); $scope, (err.toString()||'').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error');
} else { } else {
$scope.loading = false;
$rootScope.iden = iden; $rootScope.iden = iden;
$rootScope.wallet = w; $rootScope.wallet = w;
controllerUtils.bindWallet(w, $scope); controllerUtils.bindWallet(w, $scope);

View file

@ -1,8 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('JoinController', angular.module('copayApp.controllers').controller('JoinController',
function($scope, $rootScope, $timeout, identity, controllerUtils, Passphrase, notification) { function($scope, $rootScope, $timeout, controllerUtils, notification) {
controllerUtils.redirIfLogged();
$rootScope.fromSetup = false; $rootScope.fromSetup = false;
$scope.loading = false; $scope.loading = false;
$scope.isMobile = !!window.cordova; $scope.isMobile = !!window.cordova;
@ -120,31 +119,32 @@ angular.module('copayApp.controllers').controller('JoinController',
$scope.loading = true; $scope.loading = true;
Passphrase.getBase64Async($scope.joinPassword, function(passphrase) { $rootScope.iden.joinWallet({
identity.joinCreateSession({ secret: $scope.connectionId,
secret: $scope.connectionId, nickname: $scope.nickname,
nickname: $scope.nickname, privateHex: $scope.private,
passphrase: passphrase, }, function(err, w) {
privateHex: $scope.private,
}, function(err, w) {
$scope.loading = false; $scope.loading = false;
if (err || !w) { if (err || !w) {
if (err === 'joinError') if (err === 'joinError')
notification.error('Fatal error connecting to Insight server'); notification.error('Fatal error connecting to Insight server');
else if (err === 'walletFull') else if (err === 'walletFull')
notification.error('The wallet is full'); notification.error('The wallet is full');
else if (err === 'badNetwork') else if (err === 'badNetwork')
notification.error('Network Error', 'Wallet network configuration missmatch'); notification.error('Network Error', 'Wallet network configuration missmatch');
else if (err === 'badSecret') else if (err === 'badSecret')
notification.error('Bad secret', 'The secret string you entered is invalid'); notification.error('Bad secret', 'The secret string you entered is invalid');
else else
notification.error('Unknown error'); notification.error('Unknown error');
controllerUtils.onErrorDigest(); controllerUtils.onErrorDigest();
} else { } else {
controllerUtils.startNetwork(w, $scope); $rootScope.iden.closeWallet($rootScope.wallet.id, function() {
} $scope.loading = false;
}); $rootScope.wallet = w;
controllerUtils.bindWallet(w, $scope);
});
}
}); });
} }
}); });

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('MoreController', angular.module('copayApp.controllers').controller('MoreController',
function($scope, $rootScope, $location, $filter, backupService, identity, controllerUtils, notification, rateService) { function($scope, $rootScope, $location, $filter, backupService, controllerUtils, notification, rateService) {
var w = $rootScope.wallet; var w = $rootScope.wallet;
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; $scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
@ -81,7 +81,7 @@ angular.module('copayApp.controllers').controller('MoreController',
}; };
$scope.deleteWallet = function() { $scope.deleteWallet = function() {
identity.delete(w.id, function() { $rootScope.iden.deleteWallet(w.id, function() {
controllerUtils.logout(); controllerUtils.logout();
}); });
}; };

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('OpenController', function($scope, $rootScope, $location, identity, controllerUtils, Passphrase, notification) { angular.module('copayApp.controllers').controller('OpenController', function($scope, $rootScope, $location, controllerUtils, Passphrase, notification) {
controllerUtils.redirIfLogged(); controllerUtils.redirIfLogged();
if ($rootScope.pendingPayment) { if ($rootScope.pendingPayment) {

View file

@ -58,9 +58,9 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
} }
if ($rootScope.wallet) { if ($rootScope.wallet) {
$scope.$on('$idleWarn', function(a,countdown) { $scope.$on('$idleWarn', function(a, countdown) {
if (!(countdown%5)) if (!(countdown % 5))
notification.warning('Session will be closed', $filter('translate')('Your session is about to expire due to inactivity in') + ' ' + countdown + ' ' + $filter('translate')('seconds')); notification.warning('Session will be closed', $filter('translate')('Your session is about to expire due to inactivity in') + ' ' + countdown + ' ' + $filter('translate')('seconds'));
}); });
$scope.$on('$idleTimeout', function() { $scope.$on('$idleTimeout', function() {
@ -71,4 +71,21 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
$rootScope.wallet.keepAlive(); $rootScope.wallet.keepAlive();
}); });
} }
$scope.switchWallet = function(id) {
var iden = $rootScope.iden;
controllerUtils.unbindWallet($scope);
iden.openWallet(id, null, function(err, w) {
if (err) {
notification.warning('Could not open wallet');
} else {
iden.closeWallet($rootScope.wallet.id, function() {
$scope.loading = false;
$rootScope.wallet = w;
controllerUtils.bindWallet(w, $scope);
});
}
});
};
}); });

View file

@ -111,14 +111,13 @@ angular.module('copayApp.directives')
}; };
} }
]) ])
.directive('walletSecret', ['walletFactory', .directive('walletSecret', function() {
function(walletFactory) {
return { return {
require: 'ngModel', require: 'ngModel',
link: function(scope, elem, attrs, ctrl) { link: function(scope, elem, attrs, ctrl) {
var validator = function(value) { var validator = function(value) {
var a = new Address(value); var a = new Address(value);
ctrl.$setValidity('walletSecret', !a.isValid() && Boolean(walletFactory.decodeSecret(value))); ctrl.$setValidity('walletSecret', !a.isValid() && Boolean(copay.Wallet.decodeSecret(value)));
return value; return value;
}; };
@ -126,7 +125,7 @@ angular.module('copayApp.directives')
} }
}; };
} }
]) )
.directive('loading', function() { .directive('loading', function() {
return { return {
restrict: 'A', restrict: 'A',

View file

@ -94,8 +94,8 @@ Identity._walletRead = function(id, s, n, b, skip, cb) {
return Wallet.read(id, s, n, b, skip, cb); return Wallet.read(id, s, n, b, skip, cb);
}; };
Identity._walletDelete = function(id, cb) { Identity._walletDelete = function(id, s, cb) {
return Wallet.delete(id, cb); return Wallet.delete(id, s, cb);
}; };
/* for stubbing */ /* for stubbing */
@ -133,6 +133,7 @@ Identity.create = function(email, password, opts, cb) {
requiredCopayers: 1, requiredCopayers: 1,
totalCopayers: 1, totalCopayers: 1,
password: password, password: password,
name: 'general',
}); });
iden.createWallet(wopts, function(err, w) { iden.createWallet(wopts, function(err, w) {
return cb(null, iden, w); return cb(null, iden, w);
@ -170,10 +171,22 @@ Identity.open = function(email, password, opts, cb) {
Identity._openProfile(email, password, iden.storage, function(err, profile) { Identity._openProfile(email, password, iden.storage, function(err, profile) {
if (err) return cb(err); if (err) return cb(err);
iden.profile = profile; iden.profile = profile;
var wid = iden.listWallets()[0].id;
iden.openWallet(wid, password, function(err, w) { var wids = _.pluck(iden.listWallets(), 'id');
return cb(err, iden, w);
})
while (1) {
var wid = wids.shift();
if (!wid)
return new Error('Could not open any wallet from profile');
iden.openWallet(wid, password, function(err, w) {
if (err)
log.info('Cound not open wallet id:' + wid + '. Skipping')
else
return cb(err, iden, w);
})
}
}); });
}; };
@ -222,6 +235,16 @@ Identity.prototype.store = function(opts, cb) {
}; };
Identity.prototype._cleanUp = function() {
log.info('Cleaning Network connections')
var self = this;
_.each(['livenet', 'testnet'], function(n) {
self.networks[n].cleanUp();
self.blockchains[n].destroy();
});
};
/** /**
* @desc Closes the wallet and disconnects all services * @desc Closes the wallet and disconnects all services
*/ */
@ -234,12 +257,17 @@ Identity.prototype.close = function(cb) {
return cb ? cb() : null; return cb ? cb() : null;
} }
var self = this;
_.each(this.openWallets, function(w) { _.each(this.openWallets, function(w) {
w.close(function(err) { w.close(function(err) {
console.log('[Identity.js.239:err:]', err); //TODO
if (err) return cb(err); if (err) return cb(err);
if (++i == l && cb) console.log('[Identity.js.241]', i, l); //TODO
return cb(); if (++i == l) {
self._cleanUp();
if (cb) return cb();
}
}) })
}); });
}; };
@ -268,6 +296,22 @@ Identity.prototype.importWallet = function(base64, password, skipFields, cb) {
w.store(cb); w.store(cb);
}); });
}; };
Identity.prototype.closeWallet = function(wid, cb) {
var w = _.findWhere(this.openWallets, function(w) {
w.id === wid;
});
preconditions.checkState(w);
var self = this;
w.close(function(err) {
self.openWallets = _.without(self.openWallets, function(id) {
id === wid
});
return cb(err);
});
};
/** /**
* @desc This method prepares options for a new Wallet * @desc This method prepares options for a new Wallet
* *
@ -345,13 +389,15 @@ Identity.prototype.createWallet = function(opts, cb) {
var w = Identity._newWallet(opts); var w = Identity._newWallet(opts);
this.addWallet(w, function(err) { this.addWallet(w, function(err) {
if (err) return cb(err); if (err) return cb(err);
self.openWallets.push(w);
self.profile.setLastOpenedTs(w.id, function(err) { self.profile.setLastOpenedTs(w.id, function(err) {
return cb(err, w); return cb(err, w);
}); });
}); });
}; };
// add open wallet? // add wallet (import)
Identity.prototype.addWallet = function(wallet, cb) { Identity.prototype.addWallet = function(wallet, cb) {
preconditions.checkArgument(wallet); preconditions.checkArgument(wallet);
preconditions.checkArgument(wallet.getId); preconditions.checkArgument(wallet.getId);
@ -359,10 +405,11 @@ Identity.prototype.addWallet = function(wallet, cb) {
preconditions.checkState(this.profile); preconditions.checkState(this.profile);
var self = this; var self = this;
self.profile.addWallet(wallet.id, {}, function(err) { self.profile.addWallet(wallet.getId(), {
name: wallet.name
}, function(err) {
if (err) return cb(err); if (err) return cb(err);
self.openWallets.push(wallet);
wallet.store(function(err) { wallet.store(function(err) {
return cb(err); return cb(err);
}); });
@ -400,15 +447,19 @@ Identity.prototype._checkVersion = function(inVersion) {
* @return * @return
*/ */
Identity.prototype.openWallet = function(walletId, password, cb) { Identity.prototype.openWallet = function(walletId, password, cb) {
console.log('[Identity.js.434:openWallet:]', walletId); //TODO
preconditions.checkArgument(cb); preconditions.checkArgument(cb);
var self = this; var self = this;
self.storage.setPassword(password); if (password)
self.storage.setPassword(password);
// TODO // TODO
// self.migrateWallet(walletId, password, function() { // self.migrateWallet(walletId, password, function() {
Identity._walletRead(walletId, self.storage, self.networks, self.blockchains, [], function(err, w) { Identity._walletRead(walletId, self.storage, self.networks, self.blockchains, [], function(err, w) {
if (err) return cb(err); if (err) return cb(err);
self.openWallets.push(w);
w.store(function(err) { w.store(function(err) {
self.profile.setLastOpenedTs(walletId, function() { self.profile.setLastOpenedTs(walletId, function() {
@ -421,7 +472,8 @@ Identity.prototype.openWallet = function(walletId, password, cb) {
Identity.prototype.listWallets = function(a) { Identity.prototype.listWallets = function(a) {
return this.profile.listWallets(); var ret = this.profile.listWallets();
return ret;
}; };
/** /**
@ -468,7 +520,6 @@ Identity.prototype.decodeSecret = function(secret) {
* *
* @param {object} opts * @param {object} opts
* @param {string} opts.secret - the wallet secret * @param {string} opts.secret - the wallet secret
* @param {string} opts.password - a password to use to encrypt the wallet for persistance
* @param {string} opts.nickname - a nickname for the current user * @param {string} opts.nickname - a nickname for the current user
* @param {string} opts.privateHex - the private extended master key * @param {string} opts.privateHex - the private extended master key
* @param {walletCreationCallback} cb - a callback * @param {walletCreationCallback} cb - a callback
@ -476,8 +527,6 @@ Identity.prototype.decodeSecret = function(secret) {
Identity.prototype.joinWallet = function(opts, cb) { Identity.prototype.joinWallet = function(opts, cb) {
preconditions.checkArgument(opts); preconditions.checkArgument(opts);
preconditions.checkArgument(opts.secret); preconditions.checkArgument(opts.secret);
preconditions.checkArgument(opts.password);
preconditions.checkArgument(opts.nickname);
preconditions.checkArgument(cb); preconditions.checkArgument(cb);
var self = this; var self = this;
var decodedSecret = this.decodeSecret(opts.secret); var decodedSecret = this.decodeSecret(opts.secret);
@ -534,8 +583,10 @@ Identity.prototype.joinWallet = function(opts, cb) {
walletOpts.id = data.walletId; walletOpts.id = data.walletId;
walletOpts.privateKey = privateKey; walletOpts.privateKey = privateKey;
walletOpts.nickname = opts.nickname; walletOpts.nickname = opts.nickname || self.profile.name;
walletOpts.password = opts.password;
if (opts.password)
walletOpts.password = opts.password;
self.createWallet(walletOpts, function(err, w) { self.createWallet(walletOpts, function(err, w) {

View file

@ -12,7 +12,7 @@ function Profile(info, storage) {
this.hash = info.hash; this.hash = info.hash;
this.email = info.email; this.email = info.email;
this.extra = info.extra; this.extra = info.extra || {};
this.walletInfos = info.walletInfos || {}; this.walletInfos = info.walletInfos || {};
this.key = Profile.key(this.hash); this.key = Profile.key(this.hash);
@ -69,7 +69,7 @@ Profile.prototype.getWallet = function(walletId, cb) {
Profile.prototype.listWallets = function(opts, cb) { Profile.prototype.listWallets = function(opts, cb) {
return _.sortBy(this.walletInfos, function(winfo) { return _.sortBy(this.walletInfos, function(winfo) {
return winfo.lastOpenedTs || winfo.createdTs; return -winfo.lastOpenedTs || -winfo.createdTs;
}); });
}; };
@ -141,4 +141,9 @@ Profile.prototype.store = function(opts, cb) {
}); });
}; };
Profile.prototype.getName = function() {
return this.extra.nickname || this.email;
};
module.exports = Profile; module.exports = Profile;

View file

@ -183,12 +183,13 @@ Storage.prototype.delete = function(key, cb) {
}; };
Storage.prototype.deletePrefix = function(prefix, cb) { Storage.prototype.deletePrefix = function(prefix, cb) {
storage.getFirst(prefix, function(err, v, k) { var self = this;
if (err && !v) return cb(err); this.getFirst(prefix, function(err, v, k) {
if (err || !v) return cb(err);
storage.delete(k, function(err) { self.delete(k, function(err) {
if (err) return cb(err); if (err) return cb(err);
storage.deletePrefix(prefix, cb); self.deletePrefix(prefix, cb);
}) })
}); });
}; };

View file

@ -241,6 +241,7 @@ Wallet.read = function(walletId, storage, network, blockchain, skipFields, cb) {
var w, err; var w, err;
obj.id = walletId; obj.id = walletId;
try { try {
log.debug('## OPENING Wallet: ' + walletId);
w = self.fromObj(obj, storage, network, blockchain, skipFields); w = self.fromObj(obj, storage, network, blockchain, skipFields);
} catch (e) { } catch (e) {
log.debug("ERROR: ", e.message); log.debug("ERROR: ", e.message);
@ -892,6 +893,7 @@ Wallet.prototype.netStart = function() {
self.emit('connectionError'); self.emit('connectionError');
}); });
log.debug('Starting wallet networking');
net.start(startOpts, function() { net.start(startOpts, function() {
self._setBlockchainListeners(); self._setBlockchainListeners();
self.emit('ready', net.getPeer()); self.emit('ready', net.getPeer());
@ -2536,10 +2538,8 @@ Wallet.prototype.indexDiscovery = function(start, change, copayerIndex, gap, cb)
*/ */
Wallet.prototype.close = function(cb) { Wallet.prototype.close = function(cb) {
var self = this; var self = this;
log.debug('## CLOSING Wallet'); log.debug('## CLOSING Wallet: ' + this.id);
this.lock.release(function() { this.lock.release(function() {
self.network.cleanUp();
self.blockchain.destroy();
if (cb) return cb(); if (cb) return cb();
}); });
}; };

View file

@ -20,7 +20,7 @@ angular
}) })
.when('/join', { .when('/join', {
templateUrl: 'views/join.html', templateUrl: 'views/join.html',
validate: false validate: true
}) })
.when('/import', { .when('/import', {
templateUrl: 'views/import.html', templateUrl: 'views/import.html',

View file

@ -154,13 +154,18 @@ angular.module('copayApp.services')
}); });
}; };
root.unbindWallet = function($scope) {
var w =$rootScope.wallet;
w.removeAllListeners();
};
root.bindWallet = function(w, $scope) { root.bindWallet = function(w, $scope) {
root.setupRootVariables(); root.setupRootVariables();
root.installWalletHandlers(w, $scope); root.installWalletHandlers(w, $scope);
root.updateAddressList(); root.updateAddressList();
notification.enableHtml5Mode(); // for chrome: if support, enable it notification.enableHtml5Mode(); // for chrome: if support, enable it
w.netStart(); w.netStart();
}; };
// TODO movie this to wallet // TODO movie this to wallet

View file

@ -1,11 +1,9 @@
<div class="waiting-copayers" ng-controller="CopayersController"> <div class="waiting-copayers" ng-controller="CopayersController">
<div ng-if='$root.wallet && $root.wallet.isReady()' ng-init="goToWallet()"></div> <div ng-if='$root.wallet && $root.wallet.isReady()' ng-init="goToWallet()"></div>
<div class="row" ng-if='$root.wallet && !$root.wallet.isReady() && !loading'>
<div class="large-4 columns logo-setup"> <div class="row collapse m0">
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59"> <div class="large-6 columns">
<div ng-include="'views/includes/version.html'"></div>
</div>
<div class="large-8 columns line-dashed-setup-v">
<div class="box-setup oh"> <div class="box-setup oh">
<div ng-if="!$root.wallet.publicKeyRing.isComplete()"> <div ng-if="!$root.wallet.publicKeyRing.isComplete()">
<img src="img/step-3.png" alt="Step 3" width="157" class="right m15t" ng-if="$root.fromSetup && !isMobile"> <img src="img/step-3.png" alt="Step 3" width="157" class="right m15t" ng-if="$root.fromSetup && !isMobile">

View file

@ -35,6 +35,22 @@
</div> </div>
</div> </div>
<p translate class="comment" ng-show="totalCopayers>1">(*) The limits are imposed by the bitcoin network.</p> <p translate class="comment" ng-show="totalCopayers>1">(*) The limits are imposed by the bitcoin network.</p>
<a class="expand small" ng-click="hideAdv=!hideAdv">
<i class="fi-widget m3r"></i>
<span translate ng-hide="!hideAdv">Show</span>
<span translate ng-hide="hideAdv">Hide</span>
<span translate>advanced options</span>
</a>
<div ng-hide="hideAdv" class="m10t">
<input id="network-name" type="checkbox" ng-model="networkName" ng-true-value="testnet" ng-false-value="livenet" class="form-control" ng-checked="networkName == 'testnet' ? true : false">
<label for="network-name" translate>Use test network</label>
<p>
<input type="text" placeholder="BIP32 master extended private key (hex)" name="private" ng-model="private">
</div>
<div class="text-right"> <div class="text-right">
<button translate type="submit" class="button secondary m0" ng-disabled="setupForm.$invalid || loading"> <button translate type="submit" class="button secondary m0" ng-disabled="setupForm.$invalid || loading">
Create {{requiredCopayers}}-of-{{totalCopayers}} wallet Create {{requiredCopayers}}-of-{{totalCopayers}} wallet

View file

@ -11,13 +11,20 @@
<div> <div>
Available wallets Available wallets
<ul class="side-nav"> <ul class="side-nav">
<li data-ng-repeat="item in $root.iden.listWallets()" class="nav-item"> <li data-ng-repeat="item in $root.iden.listWallets() track by $index" class="nav-item">
{{item.id}} <a ng-click="switchWallet(item.id)">
{{item.name || item.id}}
</a>
</li> </li>
<li class="nav-item" ui-route="{{create}}"> <li class="nav-item" ui-route="{{create}}">
<a href="#!/create">+ {{'Create a new wallet' | translate }} <a href="#!/create">+ {{'Create ' | translate }} </a> <a href="#!/join">+ {{'Join' | translate }} </a>
</a>
</li> </li>
<li>
<a href="#!/" class="db p20h" title="Close"
ng-click="signout()"><i class="size-21 m20r fi-power"></i> {{'Close'|translate}}</a>
</li>
</ul> </ul>
</div> </div>
@ -70,10 +77,6 @@
</span> </span>
</a> </a>
</li> </li>
<li>
<a href="#!/" class="db p20h" title="Close"
ng-click="signout()"><i class="size-21 m20r fi-power"></i> {{'Close'|translate}}</a>
</li>
</ul> </ul>
<div ng-show="$root.wallet.isShared()" ng-include="'views/includes/peer-list.html'"></div> <div ng-show="$root.wallet.isShared()" ng-include="'views/includes/peer-list.html'"></div>

View file

@ -3,107 +3,77 @@
<i class="size-60 fi-bitcoin-circle icon-rotate spinner"></i> <i class="size-60 fi-bitcoin-circle icon-rotate spinner"></i>
<span translate>Connecting to Insight Wallet Server...</span> <span translate>Connecting to Insight Wallet Server...</span>
</div> </div>
<div class="row" ng-show="!loading">
<div class="large-4 columns logo-setup">
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
<div ng-include="'views/includes/version.html'"></div>
</div>
<div class="large-8 columns">
<div class="box-setup">
<h1 translate class="text-primary line-sidebar-b">Join a Wallet in Creation</h1>
<form name="joinForm" ng-submit="join(joinForm)" novalidate>
<label for="connectionId" class="m10b"><span translate>Wallet Secret</span> <h1>{{'Join Wallet'|translate}}</h1>
<small translate class="has-error" ng-show="joinForm.connectionId.$invalid <div class="row collapse m0">
<div class="large-6 columns">
<div class="box-setup">
<h1 translate class="text-primary line-sidebar-b">Join a Wallet in Creation</h1>
<form name="joinForm" ng-submit="join(joinForm)" novalidate>
<label for="connectionId"><span translate>Wallet Secret</span>
<small translate class="has-error" ng-show="joinForm.connectionId.$invalid
&& !joinForm.connectionId.$pristine">Wallet Secret is not valid!</small> && !joinForm.connectionId.$pristine">Wallet Secret is not valid!</small>
<small translate data-options="disable_for_touch:true" <small translate data-options="disable_for_touch:true" ng-show="joinForm.connectionId.$pristine" class="has-tip
ng-show="joinForm.connectionId.$pristine" class="has-tip text-gray" tooltip="Paste wallet secret here">Required</small>
text-gray" tooltip="Paste wallet secret here" >Required</small> </label>
</label>
<div class="row collapse">
<div class="large-10 medium-10 small-10 columns pr">
<input id="connectionId" type="text" class="small-9 columns"
placeholder="{{'Paste wallet secret here'|translate}}" name="connectionId" ng-model="connectionId" wallet-secret required>
<small class="icon-input" ng-show="joinForm.connectionId.$invalid && !joinForm.connectionId.$pristine"><i class="fi-x"></i></small>
<small class="icon-input" ng-show="joinForm.connectionId.$valid
&& !joinForm.connectionId.$pristine"><i class="fi-check"></i></small>
</div>
<div class="small-2 columns" ng-hide="showScanner || disableScanner">
<a class="postfix button primary" ng-click="openScanner()"><i class="fi-camera">&nbsp;</i></a>
</div>
<div class="small-2 columns" ng-show="showScanner">
<a class="postfix button warning" ng-click="cancelScanner()"><i class="fi-x">&nbsp;</i></a>
</div>
</div>
<div id="scanner" class="row" ng-if="showScanner"> <div class="row collapse">
<div class="text-centered"> <div class="large-10 medium-10 small-10 columns pr">
<canvas id="qr-canvas" width="200" height="150"></canvas> <input id="connectionId" type="text" class="small-9 columns" placeholder="{{'Paste wallet secret here'|translate}}" name="connectionId" ng-model="connectionId" wallet-secret required>
<div ng-show="isMobile"> <small class="icon-input" ng-show="joinForm.connectionId.$invalid && !joinForm.connectionId.$pristine"><i class="fi-x"></i></small>
<div id="file-input-wrapper" class="btn btn-primary"> <small class="icon-input" ng-show="joinForm.connectionId.$valid
<span class="pull-left text-centered"> && !joinForm.connectionId.$pristine"><i class="fi-check"></i></small>
</div>
<div class="small-2 columns" ng-hide="showScanner || disableScanner">
<a class="postfix button primary" ng-click="openScanner()"><i class="fi-camera">&nbsp;</i></a>
</div>
<div class="small-2 columns" ng-show="showScanner">
<a class="postfix button warning" ng-click="cancelScanner()"><i class="fi-x">&nbsp;</i></a>
</div>
</div>
<div id="scanner" class="row" ng-if="showScanner">
<div class="text-centered">
<canvas id="qr-canvas" width="200" height="150"></canvas>
<div ng-show="isMobile">
<div id="file-input-wrapper" class="btn btn-primary">
<span class="pull-left text-centered">
<i class="glyphicon glyphicon-refresh icon-rotate"></i> <i class="glyphicon glyphicon-refresh icon-rotate"></i>
<span translate>Get QR code</span> <span translate>Get QR code</span>
</span> </span>
<input id="qrcode-camera" type="file" capture="camera" accept="image/*"> <input id="qrcode-camera" type="file" capture="camera" accept="image/*">
</div>
</div>
<div ng-hide="isMobile">
<video id="qrcode-scanner-video" width="300" height="225" ng-hide="isMobile"></video>
</div> </div>
</div> </div>
<div ng-hide="isMobile">
<video id="qrcode-scanner-video" width="300" height="225" ng-hide="isMobile"></video>
</div>
</div> </div>
</div>
<label translate for="joinPassword" class="m10b">User information</label> <a class="expand small" ng-click="hideAdv=!hideAdv">
<input id="joinPassword" type="text" class="form-control" <i class="fi-widget m3r"></i>
placeholder="{{'Your name'|translate}}" name="nickname" <span translate ng-hide="!hideAdv">Show</span>
ng-model="nickname" required> <span translate ng-hide="hideAdv">Hide</span>
<input type="password" class="form-control" <span translate>advanced options</span>
placeholder="{{'Choose your password'|translate}}" name="joinPassword" </a>
ng-model="$parent.joinPassword" <div ng-hide="hideAdv" class="m10t">
check-strength="passwordStrength" <p>
tooltip-html-unsafe="Password strength: <input type="text" placeholder="BIP32 master extended private key (hex)" name="private" ng-model="$parent.private">
<i>{{passwordStrength}}</i><br/><span class='size-12'>Tip: Use lower and uppercase, </div>
numbers and symbols</span>" tooltip-trigger="focus"
tooltip-placement="top" required>
<div class="pr"> <div class="text-right">
<input type="password" <button translate type="submit" class="button primary m0" ng-disabled="joinForm.$invalid || loading">Join</button>
placeholder="{{'Repeat password'|translate}}" </div>
name="joinPasswordConfirm"
ng-model="joinPasswordConfirm"
match="joinPassword" required>
<small class="icon-input" ng-show="joinForm.joinPasswordConfirm.$dirty && joinForm.joinPasswordConfirm.$invalid"><i class="fi-x"></i></small>
<p class="m15b text-gray size-12" ng-show="joinForm.joinPasswordConfirm.$dirty && joinForm.joinPasswordConfirm.$invalid">
<i class="fi-x m5r"></i>
{{'Passwords must match'|translate}}
</p>
</div>
<a class="expand small" ng-click="hideAdv=!hideAdv">
<i class="fi-widget m3r"></i>
<span translate ng-hide="!hideAdv">Show</span>
<span translate ng-hide="hideAdv">Hide</span> </form>
<span translate>advanced options</span> </div>
</a>
<div ng-hide="hideAdv" class="m10t">
<p>
<input type="text"
placeholder="BIP32 master extended private key (hex)"
name="private"
ng-model="$parent.private"
>
</div>
<div class="text-right m20t">
<a href="#!/" class="back-button text-primary m20r">&laquo; <span translate>Back</span></a>
<button translate type="submit" class="button primary m0" ng-disabled="joinForm.$invalid || loading">Join</button>
</div>
</form>
</div>
</div> </div>
</div> <!-- End !loading --> </div>
<!-- End !loading -->
</div> </div>