fix create profile
This commit is contained in:
parent
abaf5b8f13
commit
1e013b1bb6
7 changed files with 37 additions and 34 deletions
|
|
@ -1,21 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, notification, pluginManager, identityService) {
|
||||
|
||||
identityService.goWalletHome();
|
||||
|
||||
$scope.loading = false;
|
||||
$scope.createProfile = function(form) {
|
||||
if (form && form.$invalid) {
|
||||
$scope.error('Error', 'Please enter the required fields');
|
||||
return;
|
||||
}
|
||||
$rootScope.starting = true;
|
||||
identityService.create(
|
||||
form.email.$modelValue, form.password.$modelValue, function(err) {
|
||||
if (err) $scope.error('Error', err.toString());
|
||||
|
||||
$rootScope.$digest();
|
||||
$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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue