This commit is contained in:
Gabriel Bazán 2017-05-22 21:34:48 -03:00
commit c7969c9da2
2 changed files with 19 additions and 28 deletions

View file

@ -12,7 +12,6 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.formData.secret = null;
resetPasswordFields();
updateSeedSourceSelect();
$scope.setSeedSource();
});
$scope.showAdvChange = function() {
@ -67,7 +66,7 @@ angular.module('copayApp.controllers').controller('joinController',
id: 'set',
label: gettextCatalog.getString('Specify Recovery Phrase...'),
}];
$scope.formData.seedSource = $scope.seedOptions[0];
$scope.seedSource = $scope.seedOptions[0];
/*
Disable Hardware Wallets
@ -98,14 +97,6 @@ angular.module('copayApp.controllers').controller('joinController',
}
};
$scope.setSeedSource = function() {
$scope.seedSourceId = $scope.formData.seedSource.id;
$timeout(function() {
$rootScope.$apply();
});
};
$scope.join = function() {
var opts = {
@ -114,7 +105,7 @@ angular.module('copayApp.controllers').controller('joinController',
bwsurl: $scope.formData.bwsurl
}
var setSeed = $scope.seedSourceId == 'set';
var setSeed = $scope.seedSource.id == 'set';
if (setSeed) {
var words = $scope.formData.privateKey;
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
@ -144,22 +135,22 @@ angular.module('copayApp.controllers').controller('joinController',
return;
}
if ($scope.seedSourceId == walletService.externalSource.ledger.id || $scope.seedSourceId == walletService.externalSource.trezor.id || $scope.seedSourceId == walletService.externalSource.intelTEE.id) {
if ($scope.seedSource.id == walletService.externalSource.ledger.id || $scope.seedSource.id == walletService.externalSource.trezor.id || $scope.seedSource.id == walletService.externalSource.intelTEE.id) {
var account = $scope.account;
if (!account || account < 1) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return;
}
if ($scope.seedSourceId == walletService.externalSource.trezor.id || $scope.seedSourceId == walletService.externalSource.intelTEE.id)
if ($scope.seedSource.id == walletService.externalSource.trezor.id || $scope.seedSource.id == walletService.externalSource.intelTEE.id)
account = account - 1;
opts.account = account;
opts.isMultisig = true;
ongoingProcess.set('connecting' + $scope.seedSourceId, true);
ongoingProcess.set('connecting' + $scope.seedSource.id, true);
var src;
switch ($scope.seedSourceId) {
switch ($scope.seedSource.id) {
case walletService.externalSource.ledger.id:
src = ledger;
break;
@ -176,7 +167,7 @@ angular.module('copayApp.controllers').controller('joinController',
// TODO: cannot currently join an intelTEE testnet wallet (need to detect from the secret)
src.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) {
ongoingProcess.set('connecting' + $scope.seedSourceId, false);
ongoingProcess.set('connecting' + $scope.seedSource.id, false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;

View file

@ -58,19 +58,19 @@
Wallet Key
</div>
<select class="m10t"
ng-model="formData.seedSource"
ng-model="seedSource"
ng-options="seed as seed.label for seed in seedOptions"
ng-change="setSeedSource(); resizeView()">
ng-change="resizeView()">
</select>
</label>
<label class="item item-input item-stacked-label"
ng-show="seedSourceId == 'trezor' || seedSourceId == 'ledger'">
ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'">
<span class="input-label" translate>Account Number</span>
<input type="number" id="account" ng-model="formData.account" ignore-mouse-wheel>
</label>
<label class="item item-input item-stacked-label" ng-show="seedSourceId=='set'">
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
<span class="input-label" translate>Wallet Recovery Phrase</span>
<input id="ext-master"
placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
@ -80,16 +80,16 @@
ng-model="formData.privateKey">
</label>
<ion-toggle class="has-comment" ng-model="encrypt" toggle-class="toggle-positive" ng-change="resizeView()" ng-show="seedSourceId == 'new' || seedSourceId == 'set'">
<ion-toggle class="has-comment" ng-model="encrypt" toggle-class="toggle-positive" ng-change="resizeView()" ng-show="seedSource.id == 'new' || seedSource.id == 'set'">
<span class="toggle-label" translate>Add a password</span>
</ion-toggle>
<div class="comment">
<span ng-show="seedSourceId == 'new'" translate>Add an optional password to secure the recovery phrase</span>
<span ng-show="seedSourceId == 'set'" translate>The recovery phrase could require a password to be imported</span>
<span ng-show="seedSource.id == 'new'" translate>Add an optional password to secure the recovery phrase</span>
<span ng-show="seedSource.id == 'set'" translate>The recovery phrase could require a password to be imported</span>
</div>
<div class="item item-input" ng-show="encrypt">
<input ng-show="seedSourceId == 'new'"
<input ng-show="seedSource.id == 'new'"
placeholder="{{'Password'|translate}}"
type="password"
autocapitalize="off"
@ -98,7 +98,7 @@
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSourceId == 'set'"
<input ng-show="seedSource.id == 'set'"
placeholder="{{'Password'|translate}}"
type="password"
autocapitalize="off"
@ -126,7 +126,7 @@
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div>
<div class="text-center box-notification error" ng-show="(seedSourceId =='new' || seedSourceId =='set') && encrypt">
<div class="text-center box-notification error" ng-show="(seedSource.id =='new' || seedSource.id =='set') && encrypt">
<strong translate>This password cannot be recovered. If the password is lost, there is no way you could recover your funds.</strong>
</div>
@ -134,7 +134,7 @@
<span class="toggle-label" translate>I have written it down</span>
</ion-checkbox>
<label class="item item-input item-stacked-label" ng-show="seedSourceId == 'set'">
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
<span class="input-label" translate>Derivation Path</span>
<input type="text"
placeholder="{{'BIP32 path for address derivation'|translate}}"
@ -146,7 +146,7 @@
</div> <!-- list -->
<button type="submit" class="button button-standard button-primary"
ng-disabled="setupForm.$invalid || ((encrypt && !passwordSaved) || encrypt && ((seedSourceId == 'new' && !formData.createPassphrase) || (seedSourceId == 'set' && !formData.passphrase)))"
ng-disabled="setupForm.$invalid || ((encrypt && !formData.passwordSaved) || encrypt && ((seedSource.id == 'new' && !formData.createPassphrase) || (seedSource.id == 'set' && !formData.passphrase)))"
translate>Join
</button>
</form>