Wallet/js/controllers/home.js
2014-10-24 11:38:24 -03:00

31 lines
1.1 KiB
JavaScript

'use strict';
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, notification, controllerUtils, pluginManager, identityService) {
controllerUtils.redirIfLogged();
$scope.retreiving = true;
identityService.checkIdentity($scope);
$scope.openProfile = function(form) {
if (form && form.$invalid) {
notification.error('Error', 'Please enter the required fields');
return;
}
$scope.loading = true;
copay.Identity.open(form.email.$modelValue, form.password.$modelValue, {
pluginManager: pluginManager,
network: config.network,
networkName: config.networkName,
walletDefaults: config.wallet,
passphraseConfig: config.passphraseConfig,
}, function(err, iden, lastFocusedWallet) {
if (err && !iden) {
console.log('Error:' + err)
controllerUtils.onErrorDigest(
$scope, (err.toString() || '').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error');
} else {
controllerUtils.bindProfile($scope, iden, lastFocusedWallet);
}
});
}
});