mirror of https://github.com/BTCPrivate/copay.git
added copayer password support
This commit is contained in:
parent
6cd9d445dd
commit
32f27b6c0a
|
@ -4,6 +4,7 @@ angular.module('copay.setup').controller('SetupController',
|
||||||
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
|
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
|
||||||
|
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
$scope.walletPassword = $rootScope.walletPassword;
|
||||||
|
|
||||||
// ng-repeat defined number of times instead of repeating over array?
|
// ng-repeat defined number of times instead of repeating over array?
|
||||||
$scope.getNumber = function(num) {
|
$scope.getNumber = function(num) {
|
||||||
|
@ -31,15 +32,16 @@ angular.module('copay.setup').controller('SetupController',
|
||||||
updateRCSelect(tc);
|
updateRCSelect(tc);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.create = function(totalCopayers, requiredCopayers, walletName, myNickname) {
|
$scope.create = function() {
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
|
||||||
var passphrase = Passphrase.getBase64($scope.walletPassword);
|
var passphrase = Passphrase.getBase64($scope.walletPassword);
|
||||||
|
|
||||||
var opts = {
|
var opts = {
|
||||||
requiredCopayers: requiredCopayers,
|
requiredCopayers: $scope.requiredCopayers,
|
||||||
totalCopayers: totalCopayers,
|
totalCopayers: $scope.totalCopayers,
|
||||||
name: walletName,
|
name: $scope.walletName,
|
||||||
nickname: myNickname,
|
nickname: $scope.myNickname,
|
||||||
passphrase: passphrase,
|
passphrase: passphrase,
|
||||||
};
|
};
|
||||||
var w = walletFactory.create(opts);
|
var w = walletFactory.create(opts);
|
||||||
|
|
|
@ -1,31 +1,37 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.signin').controller('SigninController',
|
angular.module('copay.signin').controller('SigninController',
|
||||||
function($scope, $rootScope, $location, walletFactory, controllerUtils) {
|
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.wallets = walletFactory.getWallets();
|
$scope.wallets = walletFactory.getWallets();
|
||||||
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
|
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
|
||||||
|
$scope.openPassword = '';
|
||||||
|
|
||||||
$scope.create = function(walletName) {
|
$scope.create = function() {
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
$rootScope.walletName = walletName;
|
|
||||||
|
$rootScope.walletName = $scope.walletName;
|
||||||
|
$rootScope.walletPassword = $scope.createPassword;
|
||||||
$location.path('setup');
|
$location.path('setup');
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.open = function(walletId) {
|
$scope.open = function() {
|
||||||
$scope.loading = true;
|
if ($scope.openPassword != '') {
|
||||||
$rootScope.openedWalletId = walletId;
|
$scope.loading = true;
|
||||||
|
|
||||||
$location.path('password');
|
var passphrase = Passphrase.getBase64($scope.openPassword);
|
||||||
|
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
||||||
|
controllerUtils.startNetwork(w);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.join = function(secret, nickname ) {
|
$scope.join = function() {
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
|
||||||
walletFactory.network.on('badSecret', function() {
|
walletFactory.network.on('badSecret', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
walletFactory.joinCreateSession(secret, nickname, function(err,w) {
|
walletFactory.joinCreateSession($scope.connectionId, $scope.nickname, function(err,w) {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
||||||
if (err || !w) {
|
if (err || !w) {
|
||||||
|
@ -36,9 +42,11 @@ angular.module('copay.signin').controller('SigninController',
|
||||||
else
|
else
|
||||||
$rootScope.flashMessage = { message: 'Unknown error', type: 'error'};
|
$rootScope.flashMessage = { message: 'Unknown error', type: 'error'};
|
||||||
controllerUtils.onErrorDigest();
|
controllerUtils.onErrorDigest();
|
||||||
}
|
} else {
|
||||||
else
|
var passphrase = Passphrase.getBase64($scope.joinPassword);
|
||||||
|
w.storage._setPassphrase(passphrase);
|
||||||
controllerUtils.startNetwork(w);
|
controllerUtils.startNetwork(w);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue