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';
|
||||
|
||||
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')
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -67,6 +67,13 @@
|
|||
name="joinPasswordConfirm"
|
||||
ng-model="joinPasswordConfirm"
|
||||
match="joinPassword" required>
|
||||
|
||||
<input type="text"
|
||||
placeholder="Private"
|
||||
name="private"
|
||||
ng-model="private"
|
||||
ng-if="enterPrivate">
|
||||
|
||||
<div class="text-right">
|
||||
<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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue