Wallet/js/controllers/createProfile.js

24 lines
788 B
JavaScript
Raw Normal View History

2014-09-30 21:16:46 -03:00
'use strict';
2014-11-29 18:35:48 -03:00
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, notification, pluginManager, identityService) {
identityService.goWalletHome();
2014-09-30 21:16:46 -03:00
$scope.createProfile = function(form) {
2014-10-09 18:53:31 -03:00
if (form && form.$invalid) {
$scope.error('Error', 'Please enter the required fields');
2014-10-09 18:53:31 -03:00
return;
}
2014-11-30 03:58:38 -03:00
$rootScope.starting = true;
2014-11-30 00:31:17 -03:00
identityService.create(
form.email.$modelValue, form.password.$modelValue, function(err) {
2014-11-30 03:58:38 -03:00
$rootScope.starting = false;
if (err) {
var msg = err.toString();
if (msg.indexOf('EEXIST')>=0 || msg.indexOf('BADC')>=0 ) {
msg = 'This profile already exists'
}
$scope.error = msg;
}
2014-11-30 00:31:17 -03:00
});
2014-09-30 21:16:46 -03:00
}
});