Import profile now checks if profile exists

This commit is contained in:
Matias Pando 2014-11-19 11:15:09 -03:00
commit 551da51c41
2 changed files with 26 additions and 20 deletions

View file

@ -28,17 +28,17 @@ angular.module('copayApp.controllers').controller('ImportProfileController',
passphraseConfig: config.passphraseConfig,
}, function(err, iden) {
if (err) {
// if (err && !iden) {
$scope.loading = false;
if ((err.toString() || '').match('BADSTR')) {
$scope.error ='Bad password or corrupt profile file';
$scope.error = 'Bad password or corrupt profile file';
} else if ((err.toString() || '').match('EEXISTS')) {
$scope.error = 'Profile already exists';
} else {
$scope.error = 'Unknown error';
}
$scope.$digest();
} else {
var firstWallet = iden.getLastFocusedWallet();
controllerUtils.bindProfile($scope, iden, firstWallet);