ref password and andvanced options on join and export file view

This commit is contained in:
Javier 2016-10-07 16:23:08 -03:00
parent 8e5ac09aa4
commit 45c6cd9736
5 changed files with 72 additions and 37 deletions

View File

@ -175,8 +175,6 @@ angular.module('copayApp.controllers').controller('createController',
function _create(opts) {
ongoingProcess.set('creatingWallet', true);
$timeout(function() {
console.log(opts);
return;
profileService.createWallet(opts, function(err, client) {
ongoingProcess.set('creatingWallet', false);
if (err) {

View File

@ -1,9 +1,20 @@
'use strict';
angular.module('copayApp.controllers').controller('exportController',
function($scope, $timeout, $log, $ionicHistory, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService) {
function($scope, $timeout, $log, $ionicHistory, $ionicScrollDelegate, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService) {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.showAdvChange = function() {
$scope.showAdv = !$scope.showAdv;
$scope.resizeView();
};
$scope.resizeView = function() {
$timeout(function() {
$ionicScrollDelegate.resize();
});
};
var init = function() {
$scope.formData = {};
$scope.isEncrypted = wallet.isPrivKeyEncrypted();

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, $state, $ionicHistory, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) {
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -12,6 +12,26 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.derivationPath = derivationPathHelper.default;
$scope.account = 1;
$scope.showAdvChange = function() {
$scope.showAdv = !$scope.showAdv;
$scope.resizeView();
};
$scope.resizeView = function() {
$timeout(function() {
$ionicScrollDelegate.resize();
});
checkPasswordFields();
};
function checkPasswordFields() {
if (!$scope.encrypt) {
$scope.passphrase = $scope.createPassphrase = $scope.passwordSaved = null;
$timeout(function() {
$scope.$apply();
});
}
};
this.onQrCodeScanned = function(data) {
$scope.secret = data;
@ -156,11 +176,10 @@ angular.module('copayApp.controllers').controller('joinController',
$state.transitionTo('tabs.copayers', {
walletId: client.credentials.walletId
});
}, 100);
}
else $state.go('tabs.home')
});
} else $state.go('tabs.home');
});
}, 100);
});
};
updateSeedSourceSelect();

View File

@ -40,10 +40,12 @@
</div>
</label>
<ion-toggle ng-model="showAdv" toggle-class="toggle-stable">
<div class="item item-divider"></div>
<a class="item" ng-click="showAdvChange()">
<span translate ng-show="!showAdv">Show advanced options</span>
<span translate ng-show="showAdv">Hide advanced options</span>
</ion-toggle>
</a>
<div ng-show="showAdv">
@ -69,23 +71,6 @@
<input type="number" id="account" ng-model="account" ignore-mouse-wheel>
</label>
<div class="card" ng-show="join.seedSourceId=='new' && createPassphrase">
<div class="item item-text-wrap">
<span translate>
WARNING: The password cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the password.
</span>
</div>
</div>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId=='new'">
<span class="input-label" translate>Add a Password</span>
<input type="text"
placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
autocapitalize="off"
name="createPassphrase"
ng-model="createPassphrase">
</label>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId=='set'">
<span class="input-label" translate>Wallet Recovery Phrase</span>
<input id="ext-master"
@ -96,8 +81,21 @@
ng-model="privateKey">
</label>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId=='set'">
<span class="input-label" translate>Password</span>
<ion-toggle ng-model="encrypt" toggle-class="toggle-positive" ng-change="resizeView()" ng-show="join.seedSourceId == 'new' || join.seedSourceId == 'set'">
<span translate>Encrypt with a Password</span>
</ion-toggle>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId == 'new' && encrypt">
<span class="input-label" translate>Add a Password</span>
<input type="text"
placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
autocapitalize="off"
name="createPassphrase"
ng-model="createPassphrase">
</label>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId == 'set' && encrypt">
<span class="input-label" translate>Add a Password</span>
<input type="text"
placeholder="{{'The recovery phrase could require a password to be imported'|translate}}"
autocapitalize="off"
@ -105,6 +103,14 @@
ng-model="passphrase">
</label>
<div class="text-center box-notification error" ng-show="(join.seedSourceId =='new' || join.seedSourceId =='set') && encrypt">
<strong translate>This password cannot be recovered. If the password is lost, funds can only be recovered with a valid backup.</strong>
</div>
<ion-checkbox ng-model="passwordSaved" class="checkbox-positive" ng-show="encrypt">
<span class="toggle-label" translate>I have written it down</span>
</ion-checkbox>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId == 'set'">
<span class="input-label" translate>Derivation Path</span>
<input type="text"
@ -116,8 +122,9 @@
</div> <!-- advanced -->
</div> <!-- list -->
<button type="submit" class="button button-block button-positive" ng-disabled="joinForm.$invalid" translate>
Join
<button type="submit" class="button button-block button-positive"
ng-disabled="joinForm.$invalid || ((encrypt && !passwordSaved) || encrypt && ((join.seedSourceId == 'new' && !createPassphrase) || (join.seedSourceId == 'set' && !passphrase)))"
translate>Join
</button>
</form>
</ion-content>

View File

@ -18,13 +18,13 @@
</div>
</form>
<ion-toggle ng-show="canSign" ng-model="formData.showAdvanced" toggle-class="toggle-balanced">
<span translate ng-show="!formData.showAdvanced">Show advanced options</span>
<span translate ng-show="formData.showAdvanced">Hide advanced options</span>
</ion-toggle>
<div class="list card" ng-show="canSign">
<a class="item" ng-click="showAdvChange()">
<span translate ng-show="!showAdv">Show advanced options</span>
<span translate ng-show="showAdv">Hide advanced options</span>
</a>
<div class="card" ng-show="formData.showAdvanced">
<ion-checkbox ng-model="formData.noSignEnabled" class="checkbox-balanced" ng-change="noSignEnabledChange()">
<ion-checkbox ng-show="showAdv" ng-model="formData.noSignEnabled" class="checkbox-balanced" ng-change="noSignEnabledChange(); resizeView()">
<span class="toggle-label" translate>Do not include private key</span>
</ion-checkbox>
</div>