Wallet/js/controllers/createProfile.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

2014-09-30 21:16:46 -03:00
'use strict';
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, notification, controllerUtils, pluginManager) {
controllerUtils.redirIfLogged();
2014-10-11 14:33:45 -03:00
$scope.retreiving = true;
copay.Identity.anyProfile({
pluginManager: pluginManager,
}, function(anyProfile) {
copay.Identity.anyWallet({
pluginManager: pluginManager,
}, function(anyWallet) {
$scope.retreiving = false;
$scope.anyProfile = anyProfile;
$scope.anyWallet = anyWallet;
});
});
2014-09-30 21:16:46 -03:00
$scope.createProfile = function(form) {
2014-10-09 18:53:31 -03:00
if (form && form.$invalid) {
notification.error('Error', 'Please enter the required fields');
return;
}
2014-09-30 21:16:46 -03:00
$scope.loading = true;
copay.Identity.create(form.email.$modelValue, form.password.$modelValue, {
pluginManager: pluginManager,
network: config.network,
networkName: config.networkName,
walletDefaults: config.wallet,
2014-10-11 14:33:45 -03:00
passphraseConfig: config.passphraseConfig,
2014-10-11 14:33:45 -03:00
}, function(err, iden, firstWallet) {
controllerUtils.bindProfile($scope, iden, firstWallet);
2014-09-30 21:16:46 -03:00
});
}
});