identity now emits!
This commit is contained in:
parent
57299d675e
commit
3ae6378678
33 changed files with 376 additions and 346 deletions
|
|
@ -3,7 +3,7 @@
|
|||
angular.module('copayApp.controllers').controller('CopayersController',
|
||||
function($scope, $rootScope, $location) {
|
||||
|
||||
if (!$rootScope.wallet.isReady()) {
|
||||
if (!$rootScope.wallet.isComplete()) {
|
||||
$rootScope.title = 'Waiting copayers for ' + $rootScope.wallet.getName();
|
||||
}
|
||||
$scope.loading = false;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ angular.module('copayApp.controllers').controller('CreateController',
|
|||
notification.error('Error', 'Please enter the required fields');
|
||||
return;
|
||||
}
|
||||
$scope.loading = true;
|
||||
var opts = {
|
||||
requiredCopayers: $scope.requiredCopayers,
|
||||
totalCopayers: $scope.totalCopayers,
|
||||
|
|
@ -52,8 +51,14 @@ angular.module('copayApp.controllers').controller('CreateController',
|
|||
privateKeyHex: $scope.private,
|
||||
networkName: $scope.networkName,
|
||||
};
|
||||
identityService.createWallet(opts, function(){
|
||||
$scope.loading = false;
|
||||
$rootScope.starting = true;
|
||||
identityService.createWallet(opts, function(err, wallet){
|
||||
$rootScope.starting = false;
|
||||
if (err || !wallet) {
|
||||
copay.logger.debug(err);
|
||||
$scope.error = 'Could not create wallet.' + err;
|
||||
}
|
||||
$rootScope.$digest()
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,12 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
|
|||
$scope.error('Error', 'Please enter the required fields');
|
||||
return;
|
||||
}
|
||||
identityService.create($scope, form);
|
||||
identityService.create(
|
||||
form.email.$modelValue, form.password.$modelValue, function(err) {
|
||||
if (err) $scope.error('Error', err.toString());
|
||||
|
||||
$rootScope.$digest();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
|||
|
||||
$scope.signout = function() {
|
||||
$rootScope.signingOut = true;
|
||||
identityService.logout();
|
||||
identityService.signout();
|
||||
};
|
||||
|
||||
$scope.refresh = function() {
|
||||
var w = $rootScope.wallet;
|
||||
if (!w) return;
|
||||
|
||||
if (w.isReady()) {
|
||||
if (w.isComplete()) {
|
||||
w.sendWalletReady();
|
||||
balanceService.clearBalanceCache(w);
|
||||
balanceService.update(w, function() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,19 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
$scope.error = 'Please enter the required fields';
|
||||
return;
|
||||
}
|
||||
identityService.open($scope, form);
|
||||
$rootScope.starting = true;
|
||||
identityService.open(form.email.$modelValue, form.password.$modelValue, function(err) {
|
||||
$rootScope.starting = false;
|
||||
if (err) {
|
||||
copay.logger.warn(err);
|
||||
if ((err.toString() || '').match('PNOTFOUND')) {
|
||||
$scope.error = 'Invalid email or password';
|
||||
} else {
|
||||
$scope.error = 'Unknown error';
|
||||
}
|
||||
$rootScope.$digest()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getParam(sname) {
|
||||
|
|
|
|||
|
|
@ -125,6 +125,19 @@ angular.module('copayApp.controllers').controller('JoinController',
|
|||
privateHex: $scope.private,
|
||||
}, function(err) {
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
if (err === 'joinError')
|
||||
notification.error('Fatal error connecting to Insight server');
|
||||
else if (err === 'walletFull')
|
||||
notification.error('The wallet is full');
|
||||
else if (err === 'badNetwork')
|
||||
notification.error('Network Error', 'Wallet network configuration missmatch');
|
||||
else if (err === 'badSecret')
|
||||
notification.error('Bad secret', 'The secret string you entered is invalid');
|
||||
else {
|
||||
notification.error('Error', err.message || err);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
|
||||
identityService.deleteWallet(w.id,function() {
|
||||
$scope.loading = false;
|
||||
$scope.getWallets();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('SettingsController', function($scope, $rootScope, $window, $route, $location, $anchorScroll, notification) {
|
||||
angular.module('copayApp.controllers').controller('SettingsController', function($scope, $rootScope, $window, $route, $location, $anchorScroll, notification, applicationService) {
|
||||
$scope.title = 'Settings';
|
||||
$scope.defaultLanguage = config.defaultLanguage || 'en';
|
||||
$scope.insightLivenet = config.network.livenet.url;
|
||||
|
|
@ -94,16 +94,13 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
|||
}),
|
||||
}));
|
||||
|
||||
// Go home reloading the application
|
||||
var hashIndex = window.location.href.indexOf('#!/');
|
||||
window.location = window.location.href.substr(0, hashIndex);
|
||||
applicationService.restart();
|
||||
};
|
||||
|
||||
|
||||
$scope.reset = function() {
|
||||
localStorage.removeItem('config');
|
||||
// Go home reloading the application
|
||||
window.location.reload();
|
||||
applicationService.reload();
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('WarningController', function(
|
|||
};
|
||||
|
||||
$scope.signout = function() {
|
||||
identityService.logout();
|
||||
identityService.signout();
|
||||
};
|
||||
|
||||
$scope.ignoreLock = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue