diff --git a/js/controllers/join.js b/js/controllers/join.js index 425e15106..5c4f68986 100644 --- a/js/controllers/join.js +++ b/js/controllers/join.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('JoinController', - function($scope, $rootScope, $timeout, walletFactory, controllerUtils, Passphrase, notification) { + function($scope, $rootScope, $timeout, $location, walletFactory, controllerUtils, Passphrase, notification) { controllerUtils.redirIfLogged(); $rootScope.fromSetup = false; $scope.loading = false; @@ -15,6 +15,13 @@ angular.module('copayApp.controllers').controller('JoinController', var context; var localMediaStream; + var s = ($location.search()).enterPrivate; + if (s) { + $scope.enterPrivate = true; + } + + + var _scan = function(evt) { if (localMediaStream) { context.drawImage(video, 0, 0, 300, 225); @@ -112,7 +119,7 @@ angular.module('copayApp.controllers').controller('JoinController', walletFactory.network.on('badSecret', function() {}); Passphrase.getBase64Async($scope.joinPassword, function(passphrase) { - walletFactory.joinCreateSession($scope.connectionId, $scope.nickname, passphrase, function(err, w) { + walletFactory.joinCreateSession($scope.connectionId, $scope.nickname, passphrase, $scope.enterPrivate ? $scope.private : 'null', function(err, w) { $scope.loading = false; if (err || !w) { if (err === 'joinError') diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js index b937fa259..146f21e9a 100644 --- a/js/models/core/WalletFactory.js +++ b/js/models/core/WalletFactory.js @@ -214,16 +214,22 @@ WalletFactory.prototype.decodeSecret = function(secret) { } }; -WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphrase, cb) { - var self = this; +WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphrase, privateHex, cb) { + var self = this; var s = self.decodeSecret(secret); if (!s) return cb('badSecret'); + var privOpts = { + networkName: this.networkName, + }; + + if (privateHex && privateHex.length>10) { + privOpts.extendedPrivateKeyString = privateHex; + } + //Create our PrivateK - var privateKey = new PrivateKey({ - networkName: this.networkName - }); + var privateKey = new PrivateKey(privOpts); this.log('\t### PrivateKey Initialized'); var opts = { copayerId: privateKey.getId(), diff --git a/views/join.html b/views/join.html index 7d4492cd5..36a2e7dbc 100644 --- a/views/join.html +++ b/views/join.html @@ -67,6 +67,13 @@ name="joinPasswordConfirm" ng-model="joinPasswordConfirm" match="joinPassword" required> + + +
« Back