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) { function _create(opts) {
ongoingProcess.set('creatingWallet', true); ongoingProcess.set('creatingWallet', true);
$timeout(function() { $timeout(function() {
console.log(opts);
return;
profileService.createWallet(opts, function(err, client) { profileService.createWallet(opts, function(err, client) {
ongoingProcess.set('creatingWallet', false); ongoingProcess.set('creatingWallet', false);
if (err) { if (err) {

View File

@ -1,9 +1,20 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('exportController', 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); 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() { var init = function() {
$scope.formData = {}; $scope.formData = {};
$scope.isEncrypted = wallet.isPrivKeyEncrypted(); $scope.isEncrypted = wallet.isPrivKeyEncrypted();

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('joinController', 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 isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
@ -12,6 +12,26 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.derivationPath = derivationPathHelper.default; $scope.derivationPath = derivationPathHelper.default;
$scope.account = 1; $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) { this.onQrCodeScanned = function(data) {
$scope.secret = data; $scope.secret = data;
@ -156,11 +176,10 @@ angular.module('copayApp.controllers').controller('joinController',
$state.transitionTo('tabs.copayers', { $state.transitionTo('tabs.copayers', {
walletId: client.credentials.walletId walletId: client.credentials.walletId
}); });
}, 100); });
} } else $state.go('tabs.home');
else $state.go('tabs.home')
}); });
}, 100); });
}; };
updateSeedSourceSelect(); updateSeedSourceSelect();

View File

@ -40,10 +40,12 @@
</div> </div>
</label> </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">Show advanced options</span>
<span translate ng-show="showAdv">Hide advanced options</span> <span translate ng-show="showAdv">Hide advanced options</span>
</ion-toggle> </a>
<div ng-show="showAdv"> <div ng-show="showAdv">
@ -69,23 +71,6 @@
<input type="number" id="account" ng-model="account" ignore-mouse-wheel> <input type="number" id="account" ng-model="account" ignore-mouse-wheel>
</label> </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'"> <label class="item item-input item-stacked-label" ng-show="join.seedSourceId=='set'">
<span class="input-label" translate>Wallet Recovery Phrase</span> <span class="input-label" translate>Wallet Recovery Phrase</span>
<input id="ext-master" <input id="ext-master"
@ -96,8 +81,21 @@
ng-model="privateKey"> ng-model="privateKey">
</label> </label>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId=='set'"> <ion-toggle ng-model="encrypt" toggle-class="toggle-positive" ng-change="resizeView()" ng-show="join.seedSourceId == 'new' || join.seedSourceId == 'set'">
<span class="input-label" translate>Password</span> <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" <input type="text"
placeholder="{{'The recovery phrase could require a password to be imported'|translate}}" placeholder="{{'The recovery phrase could require a password to be imported'|translate}}"
autocapitalize="off" autocapitalize="off"
@ -105,6 +103,14 @@
ng-model="passphrase"> ng-model="passphrase">
</label> </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'"> <label class="item item-input item-stacked-label" ng-show="join.seedSourceId == 'set'">
<span class="input-label" translate>Derivation Path</span> <span class="input-label" translate>Derivation Path</span>
<input type="text" <input type="text"
@ -116,8 +122,9 @@
</div> <!-- advanced --> </div> <!-- advanced -->
</div> <!-- list --> </div> <!-- list -->
<button type="submit" class="button button-block button-positive" ng-disabled="joinForm.$invalid" translate> <button type="submit" class="button button-block button-positive"
Join ng-disabled="joinForm.$invalid || ((encrypt && !passwordSaved) || encrypt && ((join.seedSourceId == 'new' && !createPassphrase) || (join.seedSourceId == 'set' && !passphrase)))"
translate>Join
</button> </button>
</form> </form>
</ion-content> </ion-content>

View File

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