mirror of https://github.com/BTCPrivate/copay.git
fix create profile
This commit is contained in:
parent
abaf5b8f13
commit
1e013b1bb6
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -342,8 +342,8 @@ Identity.prototype.importWalletFromObj = function(obj, opts, cb) {
|
|||
log.debug('Updating Indexes for wallet:' + w.getName());
|
||||
w.updateIndexes(function(err) {
|
||||
log.debug('Adding wallet to profile:' + w.getName());
|
||||
self.updateFocusedTimestamp(w.getId());
|
||||
self.bindWallet(w);
|
||||
self.updateFocusedTimestamp(w.getId());
|
||||
|
||||
var writeOpts = _.extend({
|
||||
noWallets: true
|
||||
|
@ -544,8 +544,8 @@ Identity.prototype.createWallet = function(opts, cb) {
|
|||
var self = this;
|
||||
|
||||
var w = new walletClass(opts);
|
||||
self.updateFocusedTimestamp(w.getId());
|
||||
self.bindWallet(w);
|
||||
self.updateFocusedTimestamp(w.getId());
|
||||
self.storeWallet(w, function(err) {
|
||||
if (err) return cb(err);
|
||||
self.store({
|
||||
|
@ -636,7 +636,7 @@ Identity.prototype.decodeSecret = function(secret) {
|
|||
*/
|
||||
Identity.prototype.getLastFocusedWalletId = function() {
|
||||
var max = _.max(this.focusedTimestamp);
|
||||
var aId = this.wallets[0] ? this.wallets[0].getId() : this.walletIds[0];
|
||||
var aId = _.findKey(this.wallets) || this.walletIds[0];
|
||||
|
||||
if (!max)
|
||||
return aId;
|
||||
|
|
|
@ -77,7 +77,6 @@ angular.module('copayApp.services')
|
|||
w.balanceInfo.updating = false;
|
||||
|
||||
if (isFocused) {
|
||||
_.extend($rootScope, w.balanceInfo);
|
||||
$rootScope.updatingBalance = false;
|
||||
}
|
||||
if (cb) cb();
|
||||
|
|
|
@ -37,10 +37,10 @@ angular.module('copayApp.services')
|
|||
}
|
||||
};
|
||||
|
||||
root.create = function(email, password) {
|
||||
root.create = function(email, password, cb) {
|
||||
copay.Identity.create({
|
||||
email: form.email.$modelValue,
|
||||
password: form.password.$modelValue,
|
||||
email: email,
|
||||
password: password,
|
||||
pluginManager: pluginManager,
|
||||
network: config.network,
|
||||
networkName: config.networkName,
|
||||
|
@ -50,6 +50,7 @@ angular.module('copayApp.services')
|
|||
}, function(err, iden) {
|
||||
if (err) return cb(err);
|
||||
preconditions.checkState(iden);
|
||||
root.bind(iden);
|
||||
|
||||
var walletOptions = {
|
||||
nickname: iden.fullName,
|
||||
|
@ -60,10 +61,7 @@ angular.module('copayApp.services')
|
|||
name: 'My wallet',
|
||||
};
|
||||
iden.createWallet(walletOptions, function(err, wallet) {
|
||||
if (err) return cb(err);
|
||||
root.bind(iden);
|
||||
|
||||
return cb();
|
||||
return cb(err);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -314,6 +312,9 @@ angular.module('copayApp.services')
|
|||
passphraseConfig: config.passphraseConfig,
|
||||
}, function(err, iden) {
|
||||
if (err) return cb(err);
|
||||
root.bind(iden);
|
||||
iden.openWallets();
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
<div class="text-right">
|
||||
<span class="size-21">
|
||||
<strong>
|
||||
<span ng-if="!$root.updatingBalance">{{totalBalance || 0 |noFractionNumber}}</span>
|
||||
<span ng-if="!$root.updatingBalance">{{$root.wallet.balanceInfo.totalBalance || 0 |noFractionNumber}}</span>
|
||||
<span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
{{$root.wallet.settings.unitName}}
|
||||
</strong>
|
||||
</span>
|
||||
<span class="size-14 db m5t text-gray">
|
||||
<span ng-if="!$root.updatingBalance && alternativeBalanceAvailable">{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}</span>
|
||||
<span ng-if="!$root.updatingBalance && !alternativeBalanceAvailable">N/A</span>
|
||||
<span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
<span ng-if="!$root.wallet.balanceInfo.updatingBalance && alternativeBalanceAvailable">{{$root.wallet.balanceInfo.totalBalanceAlternative |noFractionNumber:2}} {{$root.wallet.balanceInfo.alternativeIsoCode}}</span>
|
||||
<span ng-if="!$root.wallet.balanceInfo.updatingBalance && !$root.wallet.balanceInfo.alternativeBalanceAvailable">N/A</span>
|
||||
<span ng-if="$root.wallet.balanceInfo.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
<div class="founds size-12">
|
||||
<span ng-if="!$root.wallet.isComplete()">Waiting for copayers...</span>
|
||||
<div ng-if="$root.wallet.isComplete()">
|
||||
<span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
<div ng-if="$root.wallet && !$root.updatingBalance" data-options="disable_for_touch:true">
|
||||
<b class="m5r">{{totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}}</b>
|
||||
<span ng-if="alternativeBalanceAvailable" class="alt-currency">{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}</span>
|
||||
<span ng-if="!alternativeBalanceAvailable" class="alt-currency">N/A</span>
|
||||
<span ng-if="$root.wallet.balanceInfo.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
<div ng-if="$root.wallet && !$root.wallet.balanceInfo.updatingBalance" data-options="disable_for_touch:true">
|
||||
<b class="m5r">{{$root.wallet.balanceInfo.totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}}</b>
|
||||
<span ng-if="$root.wallet.balanceInfo.alternativeBalanceAvailable" class="alt-currency">{{$root.wallet.balanceInfo.totalBalanceAlternative |noFractionNumber:2}} {{$root.wallet.balanceInfo.alternativeIsoCode}}</span>
|
||||
<span ng-if="!$root.wallet.balanceInfo.alternativeBalanceAvailable" class="alt-currency">N/A</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
<div class="founds size-12">
|
||||
<span ng-if="!$root.wallet.isComplete()">Waiting for copayers...</span>
|
||||
<div ng-if="$root.wallet.isComplete()">
|
||||
<span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
<div ng-if="$root.wallet && !$root.updatingBalance" data-options="disable_for_touch:true">
|
||||
<b class="m5r">{{totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}}</b>
|
||||
<span ng-if="alternativeBalanceAvailable" class="alt-currency">{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}</span>
|
||||
<span ng-if="!alternativeBalanceAvailable" class="alt-currency">N/A</span>
|
||||
<span ng-if="$root.wallet.balanceInfo.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
<div ng-if="$root.wallet && !$root.wallet.balanceInfo.updatingBalance" data-options="disable_for_touch:true">
|
||||
<b class="m5r">{{$root.wallet.balanceInfo.totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}}</b>
|
||||
<span ng-if="$root.wallet.balanceInfo.alternativeBalanceAvailable" class="alt-currency">{{$root.wallet.balanceInfo.totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}</span>
|
||||
<span ng-if="!$root.wallet.balanceInfo.alternativeBalanceAvailable" class="alt-currency">N/A</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -34,12 +34,12 @@
|
|||
</a>
|
||||
</div>
|
||||
</header>
|
||||
<div class="locked" ng-show="lockedBalance && !walletSelection">
|
||||
<div class="locked" ng-show="$root.wallet.balanceInfo.lockedBalance && !walletSelection">
|
||||
<span class="text-gray">
|
||||
<i class="fi-lock"></i> {{'Locked'|translate}}
|
||||
</span>
|
||||
<span ng-if="$root.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
<span ng-if="$root.wallet && !$root.updatingBalance" class="text-gray"><b>{{lockedBalance || 0|noFractionNumber}} {{$root.wallet.settings.unitName}} </b> - {{lockedBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}
|
||||
<span ng-if="$root.wallet.balanceInfo.updatingBalance"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
|
||||
<span ng-if="$root.wallet && !$root.wallet.balanceInfo.updatingBalance" class="text-gray"><b>{{$root.wallet.balanceInfo.lockedBalance || 0|noFractionNumber}} {{$root.wallet.settings.unitName}} </b> - {{$root.wallet.balanceInfo.lockedBalanceAlternative |noFractionNumber:2}} {{$root.wallet.balanceInfo.alternativeIsoCode}}
|
||||
</span>
|
||||
<i class="fi-info medium right text-gray size-14"
|
||||
tooltip="{{'Balance locked in pending transaction proposals'|translate}}"
|
||||
|
|
Loading…
Reference in New Issue