add options to enter Priv Key on join
This commit is contained in:
parent
b70857f9e1
commit
2fbbd2a53a
3 changed files with 27 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('JoinController',
|
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();
|
controllerUtils.redirIfLogged();
|
||||||
$rootScope.fromSetup = false;
|
$rootScope.fromSetup = false;
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
@ -15,6 +15,13 @@ angular.module('copayApp.controllers').controller('JoinController',
|
||||||
var context;
|
var context;
|
||||||
var localMediaStream;
|
var localMediaStream;
|
||||||
|
|
||||||
|
var s = ($location.search()).enterPrivate;
|
||||||
|
if (s) {
|
||||||
|
$scope.enterPrivate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var _scan = function(evt) {
|
var _scan = function(evt) {
|
||||||
if (localMediaStream) {
|
if (localMediaStream) {
|
||||||
context.drawImage(video, 0, 0, 300, 225);
|
context.drawImage(video, 0, 0, 300, 225);
|
||||||
|
|
@ -112,7 +119,7 @@ angular.module('copayApp.controllers').controller('JoinController',
|
||||||
walletFactory.network.on('badSecret', function() {});
|
walletFactory.network.on('badSecret', function() {});
|
||||||
|
|
||||||
Passphrase.getBase64Async($scope.joinPassword, function(passphrase) {
|
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;
|
$scope.loading = false;
|
||||||
if (err || !w) {
|
if (err || !w) {
|
||||||
if (err === 'joinError')
|
if (err === 'joinError')
|
||||||
|
|
|
||||||
|
|
@ -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);
|
var s = self.decodeSecret(secret);
|
||||||
if (!s) return cb('badSecret');
|
if (!s) return cb('badSecret');
|
||||||
|
|
||||||
|
var privOpts = {
|
||||||
|
networkName: this.networkName,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (privateHex && privateHex.length>10) {
|
||||||
|
privOpts.extendedPrivateKeyString = privateHex;
|
||||||
|
}
|
||||||
|
|
||||||
//Create our PrivateK
|
//Create our PrivateK
|
||||||
var privateKey = new PrivateKey({
|
var privateKey = new PrivateKey(privOpts);
|
||||||
networkName: this.networkName
|
|
||||||
});
|
|
||||||
this.log('\t### PrivateKey Initialized');
|
this.log('\t### PrivateKey Initialized');
|
||||||
var opts = {
|
var opts = {
|
||||||
copayerId: privateKey.getId(),
|
copayerId: privateKey.getId(),
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,13 @@
|
||||||
name="joinPasswordConfirm"
|
name="joinPasswordConfirm"
|
||||||
ng-model="joinPasswordConfirm"
|
ng-model="joinPasswordConfirm"
|
||||||
match="joinPassword" required>
|
match="joinPassword" required>
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
placeholder="Private"
|
||||||
|
name="private"
|
||||||
|
ng-model="private"
|
||||||
|
ng-if="enterPrivate">
|
||||||
|
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<a href="#!/" class="back-button text-primary m20r">« Back</a>
|
<a href="#!/" class="back-button text-primary m20r">« Back</a>
|
||||||
<button type="submit" class="button primary m0" ng-disabled="joinForm.$invalid || loading" loading="Joining">Join</button>
|
<button type="submit" class="button primary m0" ng-disabled="joinForm.$invalid || loading" loading="Joining">Join</button>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue