Merge pull request #6097 from gabrielbazan7/feat/verfpassphrase

adding verification option to passphrase and general refactor
This commit is contained in:
Gustavo Maximiliano Cortez 2017-05-23 12:09:40 -03:00 committed by GitHub
commit 270a7e3373
7 changed files with 211 additions and 120 deletions

View file

@ -19,37 +19,51 @@ angular.module('copayApp.controllers').controller('createController',
12: 1, 12: 1,
}; };
$scope.init = function(tc) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.formData = {}; $scope.formData = {};
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
var tc = $state.current.name == 'tabs.add.create-personal' ? 1 : defaults.wallet.totalCopayers;
$scope.formData.account = 1; $scope.formData.account = 1;
$scope.formData.bwsurl = defaults.bws.url; $scope.formData.bwsurl = defaults.bws.url;
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1); $scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.formData.totalCopayers = defaults.wallet.totalCopayers;
$scope.formData.derivationPath = derivationPathHelper.default; $scope.formData.derivationPath = derivationPathHelper.default;
$scope.setTotalCopayers(tc); $scope.setTotalCopayers(tc);
updateRCSelect(tc); updateRCSelect(tc);
}; resetPasswordFields();
});
$scope.showAdvChange = function() { $scope.showAdvChange = function() {
$scope.showAdv = !$scope.showAdv; $scope.showAdv = !$scope.showAdv;
$scope.encrypt = null;
$scope.resizeView(); $scope.resizeView();
}; };
$scope.checkPassword = function(pw1, pw2) {
if (pw1 && pw1.length > 0) {
if (pw2 && pw2.length > 0) {
if (pw1 == pw2) $scope.result = 'correct';
else {
$scope.formData.passwordSaved = null;
$scope.result = 'incorrect';
}
} else
$scope.result = null;
} else
$scope.result = null;
};
$scope.resizeView = function() { $scope.resizeView = function() {
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}, 10); }, 10);
checkPasswordFields(); resetPasswordFields();
}; };
function checkPasswordFields() { function resetPasswordFields() {
if (!$scope.encrypt) { $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null;
$scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = null; $timeout(function() {
$timeout(function() { $scope.$apply();
$scope.$apply(); });
});
}
}; };
function updateRCSelect(n) { function updateRCSelect(n) {
@ -112,11 +126,7 @@ angular.module('copayApp.controllers').controller('createController',
updateSeedSourceSelect(tc); updateSeedSourceSelect(tc);
}; };
$scope.create = function(form) { $scope.create = function() {
if (form && form.$invalid) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
return;
}
var opts = { var opts = {
name: $scope.formData.walletName, name: $scope.formData.walletName,

View file

@ -3,57 +3,70 @@
angular.module('copayApp.controllers').controller('joinController', angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) { function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) {
var self = this; $scope.$on("$ionicView.beforeEnter", function(event, data) {
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
$scope.bwsurl = defaults.bws.url; $scope.formData = {};
$scope.derivationPath = derivationPathHelper.default; $scope.formData.bwsurl = defaults.bws.url;
$scope.account = 1; $scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.account = 1;
$scope.formData.secret = null;
resetPasswordFields();
updateSeedSourceSelect();
});
$scope.showAdvChange = function() { $scope.showAdvChange = function() {
$scope.showAdv = !$scope.showAdv; $scope.showAdv = !$scope.showAdv;
$scope.encrypt = null;
$scope.resizeView(); $scope.resizeView();
}; };
$scope.checkPassword = function(pw1, pw2) {
if (pw1 && pw1.length > 0) {
if (pw2 && pw2.length > 0) {
if (pw1 == pw2) $scope.result = 'correct';
else {
$scope.formData.passwordSaved = null;
$scope.result = 'incorrect';
}
} else
$scope.result = null;
} else
$scope.result = null;
};
$scope.resizeView = function() { $scope.resizeView = function() {
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
}, 10); }, 10);
checkPasswordFields(); resetPasswordFields();
}; };
function checkPasswordFields() { function resetPasswordFields() {
if (!$scope.encrypt) { $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatPassword = $scope.result = null;
$scope.passphrase = $scope.createPassphrase = $scope.passwordSaved = null; $timeout(function() {
$timeout(function() { $scope.$apply();
$scope.$apply(); });
});
}
}; };
this.onQrCodeScannedJoin = function(data) { $scope.onQrCodeScannedJoin = function(data) {
$scope.secret = data; $scope.formData.secret = data;
if ($scope.joinForm) {
$scope.joinForm.secret.$setViewValue(data);
$scope.joinForm.secret.$render();
}
}; };
if ($stateParams.url) { if ($stateParams.url) {
var data = $stateParams.url; var data = $stateParams.url;
data = data.replace('copay:', ''); data = data.replace('copay:', '');
this.onQrCodeScannedJoin(data); $scope.onQrCodeScannedJoin(data);
} }
var updateSeedSourceSelect = function() { function updateSeedSourceSelect() {
self.seedOptions = [{ $scope.seedOptions = [{
id: 'new', id: 'new',
label: gettextCatalog.getString('Random'), label: gettextCatalog.getString('Random'),
}, { }, {
id: 'set', id: 'set',
label: gettextCatalog.getString('Specify Recovery Phrase...'), label: gettextCatalog.getString('Specify Recovery Phrase...'),
}]; }];
$scope.seedSource = self.seedOptions[0]; $scope.seedSource = $scope.seedOptions[0];
/* /*
Disable Hardware Wallets Disable Hardware Wallets
@ -62,21 +75,21 @@ angular.module('copayApp.controllers').controller('joinController',
if (appConfigService.name == 'copay') { if (appConfigService.name == 'copay') {
if (walletService.externalSource.ledger.supported) { if (walletService.externalSource.ledger.supported) {
self.seedOptions.push({ $scope.seedOptions.push({
id: walletService.externalSource.ledger.id, id: walletService.externalSource.ledger.id,
label: walletService.externalSource.ledger.longName label: walletService.externalSource.ledger.longName
}); });
} }
if (walletService.externalSource.trezor.supported) { if (walletService.externalSource.trezor.supported) {
self.seedOptions.push({ $scope.seedOptions.push({
id: walletService.externalSource.trezor.id, id: walletService.externalSource.trezor.id,
label: walletService.externalSource.trezor.longName label: walletService.externalSource.trezor.longName
}); });
} }
if (walletService.externalSource.intelTEE.supported) { if (walletService.externalSource.intelTEE.supported) {
seedOptions.push({ $scope.seedOptions.push({
id: walletService.externalSource.intelTEE.id, id: walletService.externalSource.intelTEE.id,
label: walletService.externalSource.intelTEE.longName label: walletService.externalSource.intelTEE.longName
}); });
@ -84,37 +97,25 @@ angular.module('copayApp.controllers').controller('joinController',
} }
}; };
this.setSeedSource = function() { $scope.join = function() {
self.seedSourceId = $scope.seedSource.id;
$timeout(function() {
$rootScope.$apply();
});
};
this.join = function(form) {
if (form && form.$invalid) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
return;
}
var opts = { var opts = {
secret: form.secret.$modelValue, secret: $scope.formData.secret,
myName: form.myName.$modelValue, myName: $scope.formData.myName,
bwsurl: $scope.bwsurl bwsurl: $scope.formData.bwsurl
} }
var setSeed = self.seedSourceId == 'set'; var setSeed = $scope.seedSource.id == 'set';
if (setSeed) { if (setSeed) {
var words = form.privateKey.$modelValue; var words = $scope.formData.privateKey;
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) { if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
opts.extendedPrivateKey = words; opts.extendedPrivateKey = words;
} else { } else {
opts.mnemonic = words; opts.mnemonic = words;
} }
opts.passphrase = form.passphrase.$modelValue; opts.passphrase = $scope.formData.passphrase;
var pathData = derivationPathHelper.parse($scope.derivationPath); var pathData = derivationPathHelper.parse($scope.formData.derivationPath);
if (!pathData) { if (!pathData) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path')); popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return; return;
@ -123,7 +124,7 @@ angular.module('copayApp.controllers').controller('joinController',
opts.networkName = pathData.networkName; opts.networkName = pathData.networkName;
opts.derivationStrategy = pathData.derivationStrategy; opts.derivationStrategy = pathData.derivationStrategy;
} else { } else {
opts.passphrase = form.createPassphrase.$modelValue; opts.passphrase = $scope.formData.createPassphrase;
} }
opts.walletPrivKey = $scope._walletPrivKey; // Only for testing opts.walletPrivKey = $scope._walletPrivKey; // Only for testing
@ -134,22 +135,22 @@ angular.module('copayApp.controllers').controller('joinController',
return; return;
} }
if (self.seedSourceId == walletService.externalSource.ledger.id || self.seedSourceId == walletService.externalSource.trezor.id || self.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; var account = $scope.account;
if (!account || account < 1) { if (!account || account < 1) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return; return;
} }
if (self.seedSourceId == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id) if ($scope.seedSource.id == walletService.externalSource.trezor.id || $scope.seedSource.id == walletService.externalSource.intelTEE.id)
account = account - 1; account = account - 1;
opts.account = account; opts.account = account;
opts.isMultisig = true; opts.isMultisig = true;
ongoingProcess.set('connecting' + self.seedSourceId, true); ongoingProcess.set('connecting' + $scope.seedSource.id, true);
var src; var src;
switch (self.seedSourceId) { switch ($scope.seedSource.id) {
case walletService.externalSource.ledger.id: case walletService.externalSource.ledger.id:
src = ledger; src = ledger;
break; break;
@ -166,21 +167,21 @@ angular.module('copayApp.controllers').controller('joinController',
// TODO: cannot currently join an intelTEE testnet wallet (need to detect from the secret) // TODO: cannot currently join an intelTEE testnet wallet (need to detect from the secret)
src.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) { src.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) {
ongoingProcess.set('connecting' + self.seedSourceId, false); ongoingProcess.set('connecting' + $scope.seedSource.id, false);
if (err) { if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err); popupService.showAlert(gettextCatalog.getString('Error'), err);
return; return;
} }
opts = lodash.assign(lopts, opts); opts = lodash.assign(lopts, opts);
self._join(opts); _join(opts);
}); });
} else { } else {
self._join(opts); _join(opts);
} }
}; };
this._join = function(opts) { function _join(opts) {
ongoingProcess.set('joiningWallet', true); ongoingProcess.set('joiningWallet', true);
$timeout(function() { $timeout(function() {
profileService.joinWallet(opts, function(err, client) { profileService.joinWallet(opts, function(err, client) {
@ -207,7 +208,4 @@ angular.module('copayApp.controllers').controller('joinController',
}); });
}); });
}; };
updateSeedSourceSelect();
self.setSeedSource();
}); });

View file

@ -323,7 +323,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/join/:url', url: '/join/:url',
views: { views: {
'tab-home@tabs': { 'tab-home@tabs': {
templateUrl: 'views/join.html' templateUrl: 'views/join.html',
controller: 'joinController'
}, },
} }
}) })
@ -340,7 +341,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/create-personal', url: '/create-personal',
views: { views: {
'tab-home@tabs': { 'tab-home@tabs': {
templateUrl: 'views/tab-create-personal.html' templateUrl: 'views/tab-create-personal.html',
controller: 'createController'
}, },
} }
}) })
@ -348,7 +350,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/create-shared', url: '/create-shared',
views: { views: {
'tab-home@tabs': { 'tab-home@tabs': {
templateUrl: 'views/tab-create-shared.html' templateUrl: 'views/tab-create-shared.html',
controller: 'createController'
}, },
} }
}) })

View file

@ -95,6 +95,21 @@
font-size: 16px; font-size: 16px;
} }
} }
input[type="password"] {
border: none;
margin-left: -5px;
padding-left: 4px;
&.incorrect {
margin-right: 10px;
border: 1px solid;
color: #C90505;
}
&.correct {
margin-right: 10px;
border: 1px solid;
color: #00901B;
}
}
} }
#tab-settings { #tab-settings {

View file

@ -6,37 +6,37 @@
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="joinController as join"> <ion-content>
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate> <form name="setupForm" ng-submit="join()" novalidate>
<div class="list settings-list settings-input-group"> <div class="list settings-list settings-input-group">
<label class="item item-input item-stacked-label no-border"> <label class="item item-input item-stacked-label no-border">
<span class="input-label" translate>Your nickname</span> <span class="input-label" translate>Your nickname</span>
<input type="text" <input type="text"
placeholder="{{'John'|translate}}" placeholder="Satoshi"
name="myName" name="myName"
ng-model="myName" ng-model="formData.myName"
ng-required="true"> required>
</label> </label>
<div> <div>
<label class="item item-input item-stacked-label no-border"> <label class="item item-input item-stacked-label no-border">
<span class="input-label" translate>Wallet Invitation</span> <span class="input-label" translate>Wallet Invitation</span>
<div class="input-notification"> <div class="input-notification">
<i ng-show="!joinForm.secret.$invalid" class="icon ion-checkmark-circled valid"></i> <i ng-show="!setupForm.secret.$invalid" class="icon ion-checkmark-circled valid"></i>
<i ng-show="joinForm.secret.$invalid && secret" class="icon ion-close-circled invalid"></i> <i ng-show="setupForm.secret.$invalid && formData.secret" class="icon ion-close-circled invalid"></i>
</div> </div>
<input id="secret" <input id="secret"
type="text" type="text"
placeholder="{{'Paste invitation here'|translate}}" placeholder="{{'Paste invitation here'|translate}}"
name="secret" name="secret"
ng-model="secret" ng-model="formData.secret"
wallet-secret required> wallet-secret required>
</label> </label>
<div class="qr-scan-icon"> <div class="qr-scan-icon">
<qr-scanner class="qr-icon size-24" on-scan="join.onQrCodeScannedJoin(data)"></qr-scanner> <qr-scanner class="qr-icon size-24" on-scan="onQrCodeScannedJoin(data)"></qr-scanner>
</div> </div>
</div> </div>
<div class="item item-divider"></div> <div class="item item-divider"></div>
@ -50,7 +50,7 @@
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label">Wallet Service URL</span> <span class="input-label">Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl"> <input type="text" id="bwsurl" name="bwsurl" ng-model="formData.bwsurl">
</label> </label>
<label class="item item-input item-select"> <label class="item item-input item-select">
@ -59,72 +59,94 @@
</div> </div>
<select class="m10t" <select class="m10t"
ng-model="seedSource" ng-model="seedSource"
ng-options="seed as seed.label for seed in join.seedOptions" ng-options="seed as seed.label for seed in seedOptions"
ng-change="join.setSeedSource()"> ng-change="resizeView()">
</select> </select>
</label> </label>
<label class="item item-input item-stacked-label" <label class="item item-input item-stacked-label"
ng-show="join.seedSourceId == 'trezor' || join.seedSourceId == 'ledger'"> ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'">
<span class="input-label" translate>Account Number</span> <span class="input-label" translate>Account Number</span>
<input type="number" id="account" ng-model="account" ignore-mouse-wheel> <input type="number" id="account" ng-model="formData.account" ignore-mouse-wheel>
</label> </label>
<label class="item item-input item-stacked-label" ng-show="join.seedSourceId=='set'"> <label class="item item-input item-stacked-label" ng-show="seedSource.id == '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"
placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}" placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
autocapitalize="off" autocapitalize="off"
type="text" type="text"
name="privateKey" name="privateKey"
ng-model="privateKey"> ng-model="formData.privateKey">
</label> </label>
<ion-toggle class="has-comment" ng-model="encrypt" toggle-class="toggle-positive" ng-change="resizeView()" ng-show="join.seedSourceId == 'new' || join.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> <span class="toggle-label" translate>Add a password</span>
</ion-toggle> </ion-toggle>
<div class="comment"> <div class="comment">
<span ng-show="join.seedSourceId == 'new'" translate>Add an optional password to secure the recovery phrase</span> <span ng-show="seedSource.id == 'new'" translate>Add an optional password to secure the recovery phrase</span>
<span ng-show="join.seedSourceId == 'set'" translate>The recovery phrase could require a password to be imported</span> <span ng-show="seedSource.id == 'set'" translate>The recovery phrase could require a password to be imported</span>
</div> </div>
<div class="item item-input" ng-show="encrypt"> <div class="item item-input" ng-show="encrypt">
<input ng-show="join.seedSourceId == 'new'" <input ng-show="seedSource.id == 'new'"
placeholder="{{'Password'|translate}}" placeholder="{{'Password'|translate}}"
type="password" type="password"
autocapitalize="off" autocapitalize="off"
name="createPassphrase" name="createPassphrase"
ng-model="createPassphrase"> ng-model="formData.createPassphrase"
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="join.seedSourceId == 'set'" <input ng-show="seedSource.id == 'set'"
placeholder="{{'Password'|translate}}" placeholder="{{'Password'|translate}}"
type="password" type="password"
autocapitalize="off" autocapitalize="off"
name="passphrase" name="passphrase"
ng-model="passphrase"> ng-model="formData.passphrase"
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div> </div>
<div class="text-center box-notification error" ng-show="(join.seedSourceId =='new' || join.seedSourceId =='set') && encrypt"> <div class="item item-input" ng-show="encrypt">
<input ng-show="seedSource.id == 'new'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatPassword"
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSource.id == 'set'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatPassword"
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div>
<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> <strong translate>This password cannot be recovered. If the password is lost, there is no way you could recover your funds.</strong>
</div> </div>
<ion-checkbox ng-model="passwordSaved" class="checkbox-positive" ng-show="encrypt"> <ion-checkbox ng-model="formData.passwordSaved" class="checkbox-positive" ng-show="encrypt && result == 'correct'">
<span class="toggle-label" translate>I have written it down</span> <span class="toggle-label" translate>I have written it down</span>
</ion-checkbox> </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="seedSource.id == 'set'">
<span class="input-label" translate>Derivation Path</span> <span class="input-label" translate>Derivation Path</span>
<input type="text" <input type="text"
placeholder="{{'BIP32 path for address derivation'|translate}}" placeholder="{{'BIP32 path for address derivation'|translate}}"
name="derivationPath" name="derivationPath"
ng-model="derivationPath"> ng-model="formData.derivationPath">
</label> </label>
</div> <!-- advanced --> </div> <!-- advanced -->
</div> <!-- list --> </div> <!-- list -->
<button type="submit" class="button button-standard button-primary" <button type="submit" class="button button-standard button-primary"
ng-disabled="joinForm.$invalid || ((encrypt && !passwordSaved) || encrypt && ((join.seedSourceId == 'new' && !createPassphrase) || (join.seedSourceId == 'set' && !passphrase)))" ng-disabled="setupForm.$invalid || ((encrypt && !formData.passwordSaved) || encrypt && ((seedSource.id == 'new' && !formData.createPassphrase) || (seedSource.id == 'set' && !formData.passphrase)))"
translate>Join translate>Join
</button> </button>
</form> </form>

View file

@ -5,8 +5,8 @@
</ion-nav-back-button> </ion-nav-back-button>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="createController" ng-init="init(1);"> <ion-content>
<form name="setupForm" ng-submit="create(setupForm)" novalidate> <form name="setupForm" ng-submit="create()" novalidate>
<div class="list settings-list settings-input-group"> <div class="list settings-list settings-input-group">
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label" translate>Wallet name</span> <span class="input-label" translate>Wallet name</span>
@ -15,7 +15,8 @@
ng-model="formData.walletName" ng-model="formData.walletName"
ng-required="true" ng-required="true"
ng-focus="formFocus('wallet-name')" ng-focus="formFocus('wallet-name')"
ng-blur="formFocus(false)"> ng-blur="formFocus(false)"
required>
</label> </label>
<div class="item item-divider"></div> <div class="item item-divider"></div>
@ -35,7 +36,7 @@
<div class="input-label" translate> <div class="input-label" translate>
Wallet Key Wallet Key
</div> </div>
<select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions"></select> <select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions" ng-change="resizeView()"></select>
</label> </label>
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'"> <label class="item item-input item-stacked-label" ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'">
@ -66,20 +67,41 @@
placeholder="{{'Password'|translate}}" placeholder="{{'Password'|translate}}"
type="password" type="password"
autocapitalize="off" autocapitalize="off"
ng-model="formData.createPassphrase"> ng-model="formData.createPassphrase"
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSource.id == 'set'" <input ng-show="seedSource.id == 'set'"
placeholder="{{'Password'|translate}}" placeholder="{{'Password'|translate}}"
type="password" type="password"
autocapitalize="off" autocapitalize="off"
ng-model="formData.passphrase"> ng-model="formData.passphrase"
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div>
<div class="item item-input" ng-show="encrypt">
<input ng-show="seedSource.id == 'new'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatPassword"
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSource.id == 'set'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatPassword"
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div> </div>
<div class="text-center box-notification error" ng-show="(seedSource.id =='new' || seedSource.id =='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> <strong translate>This password cannot be recovered. If the password is lost, there is no way you could recover your funds.</strong>
</div> </div>
<ion-checkbox ng-model="formData.passwordSaved" class="checkbox-positive" ng-show="encrypt"> <ion-checkbox ng-model="formData.passwordSaved" class="checkbox-positive" ng-show="encrypt && result == 'correct'">
<span class="toggle-label" translate>I have written it down</span> <span class="toggle-label" translate>I have written it down</span>
</ion-checkbox> </ion-checkbox>

View file

@ -5,8 +5,8 @@
</ion-nav-back-button> </ion-nav-back-button>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="createController" ng-init="init(3);"> <ion-content>
<form name="setupForm" ng-submit="create(setupForm)" novalidate> <form name="setupForm" ng-submit="create()" novalidate>
<div class="list settings-list settings-input-group"> <div class="list settings-list settings-input-group">
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label" translate>Wallet name</span> <span class="input-label" translate>Wallet name</span>
@ -65,7 +65,7 @@
<div class="input-label" translate> <div class="input-label" translate>
Wallet Key Wallet Key
</div> </div>
<select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions"></select> <select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions" ng-change="resizeView()"></select>
</label> </label>
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'"> <label class="item item-input item-stacked-label" ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'">
@ -96,20 +96,41 @@
placeholder="{{'Password'|translate}}" placeholder="{{'Password'|translate}}"
type="password" type="password"
autocapitalize="off" autocapitalize="off"
ng-model="formData.createPassphrase"> ng-model="formData.createPassphrase"
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSource.id == 'set'" <input ng-show="seedSource.id == 'set'"
placeholder="{{'Password'|translate}}" placeholder="{{'Password'|translate}}"
type="password" type="password"
autocapitalize="off" autocapitalize="off"
ng-model="formData.passphrase"> ng-model="formData.passphrase"
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div>
<div class="item item-input" ng-show="encrypt">
<input ng-show="seedSource.id == 'new'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatPassword"
ng-change="checkPassword(formData.createPassphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSource.id == 'set'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatPassword"
ng-change="checkPassword(formData.passphrase, formData.repeatPassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div> </div>
<div class="text-center box-notification error" ng-show="(seedSource.id =='new' || seedSource.id =='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> <strong translate>This password cannot be recovered. If the password is lost, there is no way you could recover your funds.</strong>
</div> </div>
<ion-checkbox ng-model="formData.passwordSaved" class="checkbox-positive" ng-show="encrypt"> <ion-checkbox ng-model="formData.passwordSaved" class="checkbox-positive" ng-show="encrypt && result == 'correct'">
<span class="toggle-label" translate>I have written it down</span> <span class="toggle-label" translate>I have written it down</span>
</ion-checkbox> </ion-checkbox>