Skip to content
Snippets Groups Projects
Commit 1827a7f8 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Assistant de création de compte > Message d'erreur furtif - FIX #715

parent fa6617e4
Branches
Tags
No related merge requests found
...@@ -185,12 +185,16 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil ...@@ -185,12 +185,16 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil
CryptoUtils.scryptKeypair($scope.formData.username, $scope.formData.password) CryptoUtils.scryptKeypair($scope.formData.username, $scope.formData.password)
.then(function(keypair) { .then(function(keypair) {
$scope.formData.pubkey = CryptoUtils.util.encode_base58(keypair.signPk); $scope.formData.pubkey = CryptoUtils.util.encode_base58(keypair.signPk);
return $scope.checkAccountAvailable();
})
.then(function() {
return $timeout(function(){
$scope.formData.computing=false; $scope.formData.computing=false;
$scope.checkAccountAvailable(); }, 400);
}) })
.catch(function(err) { .catch(function(err) {
$scope.formData.computing=false;
$scope.formData.pubkey = undefined; $scope.formData.pubkey = undefined;
$scope.formData.computing=false;
UIUtils.onError('ERROR.CRYPTO_UNKNOWN_ERROR')(err); UIUtils.onError('ERROR.CRYPTO_UNKNOWN_ERROR')(err);
}); });
}; };
...@@ -301,6 +305,11 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil ...@@ -301,6 +305,11 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil
$scope.slideBehavior = $scope.computeSlideBehavior(); $scope.slideBehavior = $scope.computeSlideBehavior();
}; };
$scope.doPrev = function() {
$scope.slidePrev();
$scope.slideBehavior = $scope.computeSlideBehavior();
};
$scope.doNewAccount = function(confirm) { $scope.doNewAccount = function(confirm) {
if (!confirm) { if (!confirm) {
...@@ -462,27 +471,25 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil ...@@ -462,27 +471,25 @@ function JoinModalController($scope, $state, $interval, $timeout, Device, UIUtil
$scope.checkAccountAvailable = function() { $scope.checkAccountAvailable = function() {
delete $scope.accountAvailable; delete $scope.accountAvailable;
// Search for tx source, from pubkey // Search for tx source, from pubkey
BMA.tx.sources({ pubkey: $scope.formData.pubkey }) return BMA.tx.sources({ pubkey: $scope.formData.pubkey })
.then(function(res) { .then(function(res) {
if(!res.sources.length) { $scope.accountAvailable = !res || !res.sources.length;
$scope.formData.computing=false;
$scope.accountAvailable = true;
}
else{
$scope.formData.computing=false;
$scope.accountAvailable = false;
}
}) })
.catch(function(err) { .catch(function(err) {
console.error(err); console.error(err);
$scope.formData.computing=false;
$scope.accountAvailable = false; $scope.accountAvailable = false;
}); });
}; };
$scope.identifierRecovery = function() { $scope.identifierRecovery = function() {
for (var i = 0; i < 2; i++) // Go back
$scope.slidePrev(); $scope.slides.slider.unlockSwipes();
for (var i = 0; i < 2; i++) {
$scope.slides.slider.slidePrev();
}
$scope.slides.slider.lockSwipes();
// Recompute behavior
$scope.slideBehavior = $scope.computeSlideBehavior();
}; };
// TODO: remove auto add account when done // TODO: remove auto add account when done
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
ng-click="closeModal()" translate>COMMON.BTN_CANCEL ng-click="closeModal()" translate>COMMON.BTN_CANCEL
</button> </button>
<button class="button button-icon button-clear icon ion-ios-arrow-back buttons header-item" <button class="button button-icon button-clear icon ion-ios-arrow-back buttons header-item"
ng-click="slidePrev()" ng-click="doPrev()"
ng-if="slides.slider.activeIndex && slideBehavior.hasPreviousButton"> ng-if="slides.slider.activeIndex && slideBehavior.hasPreviousButton">
</button> </button>
<button class="button button-icon button-clear icon ion-ios-help-outline visible-xs" <button class="button button-icon button-clear icon ion-ios-help-outline visible-xs"
...@@ -356,7 +356,8 @@ ...@@ -356,7 +356,8 @@
</div> </div>
<!-- Account available --> <!-- Account available -->
<div ng-if="accountAvailable && !formData.computing"> <ng-if ng-if="!formData.computing">
<div class="animate-fade-in animate-show-hide ng-hide" ng-show="accountAvailable">
<div class="padding text-center" translate>ACCOUNT.NEW.LAST_SLIDE_CONGRATULATION</div> <div class="padding text-center" translate>ACCOUNT.NEW.LAST_SLIDE_CONGRATULATION</div>
<div class="list"> <div class="list">
...@@ -381,7 +382,7 @@ ...@@ -381,7 +382,7 @@
</div> </div>
<!-- Existing non-empty account --> <!-- Existing non-empty account -->
<div ng-if="!accountAvailable && !formData.computing"> <div class="animate-fade-in animate-show-hide ng-hide" ng-show="!accountAvailable">
<ion-item class="item-icon-left item-text-wrap text-center"> <ion-item class="item-icon-left item-text-wrap text-center">
<i class="icon ion-minus-circled assertive"></i> <i class="icon ion-minus-circled assertive"></i>
...@@ -410,6 +411,7 @@ ...@@ -410,6 +411,7 @@
</button> </button>
</div> </div>
</div> </div>
</ng-if>
</ion-content> </ion-content>
</ion-slide-page> </ion-slide-page>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment