Fix Conflicts:

js/controllers/signin.js
This commit is contained in:
Gustavo Cortez 2014-05-06 18:12:24 -03:00
commit 88a7fca8d8
12 changed files with 295 additions and 115 deletions

View file

@ -44,6 +44,7 @@ angular.module('copay.header').controller('HeaderController',
};
$scope.refresh = function() {
var w = $rootScope.wallet;
controllerUtils.updateBalance(function() {
w.connectToAll();
$rootScope.$digest();

View file

@ -21,13 +21,31 @@ angular.module('copay.import').controller('ImportController',
};
};
$scope.import = function() {
if ($scope.password) {
if ($scope.backupText) {
_importBackup($scope.backupText);
} else {
reader.readAsBinaryString($scope.file);
}
$scope.import = function(form) {
if (form.$invalid) {
$rootScope.flashMessage = { message: 'There is an error in the form. Please, try again', type: 'error'};
return;
}
var backupFile = $scope.file;
var backupText = form.backupText.$modelValue;
var password = form.password.$modelValue;
if (!backupFile && !backupText) {
$rootScope.flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'};
return;
}
$scope.loading = true;
if (backupFile) {
reader.readAsBinaryString(backupFile);
}
else {
_importBackup(backupText);
}
$scope.loading = false;
};
});

View file

@ -32,7 +32,12 @@ angular.module('copay.setup').controller('SetupController',
updateRCSelect(tc);
});
$scope.create = function() {
$scope.create = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$scope.loading = true;
var passphrase = Passphrase.getBase64($scope.walletPassword);

View file

@ -7,30 +7,40 @@ angular.module('copay.signin').controller('SigninController',
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
$scope.openPassword = '';
$scope.create = function() {
$scope.loading = true;
$scope.create = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$rootScope.walletName = $scope.walletName;
$rootScope.walletPassword = $scope.createPassword;
$rootScope.walletName = form.walletName.$modelValue;
$rootScope.walletPassword = form.createPassword.$modelValue;
$location.path('setup');
};
$scope.open = function() {
if ($scope.openPassword != '') {
$scope.loading = true;
var passphrase = Passphrase.getBase64($scope.openPassword);
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.open = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$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);
};
$scope.join = function() {
$scope.join = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$scope.loading = true;
walletFactory.network.on('badSecret', function() {