spinner while derivating passphrase
This commit is contained in:
parent
207f345d79
commit
6afcd8cc2e
7 changed files with 91 additions and 47 deletions
|
|
@ -3,12 +3,12 @@
|
|||
angular.module('copay.import').controller('ImportController',
|
||||
function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) {
|
||||
$scope.title = 'Import a backup';
|
||||
|
||||
var reader = new FileReader();
|
||||
var _importBackup = function(encryptedObj) {
|
||||
var passphrase = Passphrase.getBase64($scope.password);
|
||||
$rootScope.wallet = walletFactory.fromEncryptedObj(encryptedObj, passphrase);
|
||||
controllerUtils.startNetwork($rootScope.wallet);
|
||||
Passphrase.getBase64Async($scope.password, function(passphrase){
|
||||
$rootScope.wallet = walletFactory.fromEncryptedObj(encryptedObj, passphrase);
|
||||
controllerUtils.startNetwork($rootScope.wallet);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getFile = function() {
|
||||
|
|
@ -44,8 +44,5 @@ angular.module('copay.import').controller('ImportController',
|
|||
else {
|
||||
_importBackup(backupText);
|
||||
}
|
||||
|
||||
$scope.loading = false;
|
||||
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.setup').controller('SetupController',
|
||||
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
|
||||
function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase) {
|
||||
|
||||
$scope.loading = false;
|
||||
$scope.walletPassword = $rootScope.walletPassword;
|
||||
|
|
@ -38,19 +38,19 @@ angular.module('copay.setup').controller('SetupController',
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
$scope.loading = true;
|
||||
|
||||
var passphrase = Passphrase.getBase64($scope.walletPassword);
|
||||
|
||||
var opts = {
|
||||
requiredCopayers: $scope.requiredCopayers,
|
||||
totalCopayers: $scope.totalCopayers,
|
||||
name: $scope.walletName,
|
||||
nickname: $scope.myNickname,
|
||||
passphrase: passphrase,
|
||||
};
|
||||
var w = walletFactory.create(opts);
|
||||
controllerUtils.startNetwork(w);
|
||||
Passphrase.getBase64Async($scope.walletPassword, function(passphrase){
|
||||
var opts = {
|
||||
requiredCopayers: $scope.requiredCopayers,
|
||||
totalCopayers: $scope.totalCopayers,
|
||||
name: $scope.walletName,
|
||||
nickname: $scope.myNickname,
|
||||
passphrase: passphrase,
|
||||
};
|
||||
var w = walletFactory.create(opts);
|
||||
controllerUtils.startNetwork(w);
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,14 +26,15 @@ angular.module('copay.signin').controller('SigninController',
|
|||
|
||||
$scope.loading = true;
|
||||
var password = form.openPassword.$modelValue;
|
||||
var passphrase = Passphrase.getBase64(password);
|
||||
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
||||
if (!w) {
|
||||
$scope.loading = false;
|
||||
$rootScope.flashMessage = { message: 'Bad password or connection error', type: 'error'};
|
||||
return;
|
||||
}
|
||||
controllerUtils.startNetwork(w);
|
||||
Passphrase.getBase64Async(password, function(passphrase){
|
||||
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
||||
if (!w) {
|
||||
$scope.loading = false;
|
||||
$rootScope.flashMessage = { message: 'Bad password or connection error', type: 'error'};
|
||||
return;
|
||||
}
|
||||
controllerUtils.startNetwork(w);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.join = function(form) {
|
||||
|
|
@ -41,26 +42,26 @@ angular.module('copay.signin').controller('SigninController',
|
|||
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
|
||||
return;
|
||||
}
|
||||
$scope.loading = true;
|
||||
|
||||
$scope.loading = true;
|
||||
walletFactory.network.on('badSecret', function() {
|
||||
});
|
||||
|
||||
var passphrase = Passphrase.getBase64($scope.joinPassword);
|
||||
walletFactory.joinCreateSession($scope.connectionId, $scope.nickname, passphrase, function(err,w) {
|
||||
$scope.loading = false;
|
||||
|
||||
if (err || !w) {
|
||||
if (err === 'joinError')
|
||||
$rootScope.flashMessage = { message: 'Can not find peer'};
|
||||
else if (err === 'badSecret')
|
||||
$rootScope.flashMessage = { message: 'Bad secret secret string', type: 'error'};
|
||||
else
|
||||
$rootScope.flashMessage = { message: 'Unknown error', type: 'error'};
|
||||
controllerUtils.onErrorDigest();
|
||||
} else {
|
||||
controllerUtils.startNetwork(w);
|
||||
}
|
||||
Passphrase.getBase64Async($scope.joinPassword, function(passphrase){
|
||||
walletFactory.joinCreateSession($scope.connectionId, $scope.nickname, passphrase, function(err,w) {
|
||||
$scope.loading = false;
|
||||
if (err || !w) {
|
||||
if (err === 'joinError')
|
||||
$rootScope.flashMessage = { message: 'Can not find peer'};
|
||||
else if (err === 'badSecret')
|
||||
$rootScope.flashMessage = { message: 'Bad secret secret string', type: 'error'};
|
||||
else
|
||||
$rootScope.flashMessage = { message: 'Unknown error', type: 'error'};
|
||||
controllerUtils.onErrorDigest();
|
||||
} else {
|
||||
controllerUtils.startNetwork(w);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue