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