added password support to UI/Controllers

This commit is contained in:
Mario Colque 2014-05-01 09:59:43 -03:00
parent cd4db8a097
commit 9d27a0b85d
4 changed files with 24 additions and 13 deletions

View File

@ -218,7 +218,6 @@
ng-options="requiredCopayers as requiredCopayers for requiredCopayers in RCValues">
</select>
</div>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
@ -230,6 +229,12 @@
</div>
</div>
<div class="row">
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Wallet Password</h6>
<input type="password" ng-model="walletPassword" placeholder="My wallet password" class="form-control" required>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Wallet name (optional)</h6>
@ -240,7 +245,6 @@
<input ng-model="myNickname" placeholder="" class="size-24" style="width:100%">
</div>
</div>
<div class="row">
<div class="large-12 columns line-dashed">
<button class="button primary radius right" type="button"
@ -258,8 +262,8 @@
<div class="" ng-controller="PasswordController">
<h3>Enter your password</h3>
<div class="large-6 columns">
<input type="password" class="form-control" placeholder="Enter your passwor" ng-model="password" autofocus="">
<button type="submit" class="button secondary round text-center" ng-click="getPassphrase()">Send</button>
<input type="password" class="form-control" placeholder="Enter your passwor" ng-model="password" autofocus required>
<button type="submit" class="button secondary round text-center" ng-click="getPassphrase()">Send</button>
</div>
</div>
</script>
@ -328,7 +332,7 @@
</div>
</div>
</script>
<!-- TRANSACTIONS -->
<script type="text/ng-template" id="transactions.html">
<div class="transactions" data-ng-controller="TransactionsController">

View File

@ -1,11 +1,15 @@
'use strict';
angular.module('copay.password').controller('PasswordController',
function($scope, $rootScope) {
function($scope, $rootScope, Passphrase, walletFactory, controllerUtils) {
$scope.title = 'Password';
$scope.loading = false;
$scope.getPassphrase = function() {
console.log('######### Password', $scope.password);
};
$scope.loading = true;
var passphrase = Passphrase.getBase64($scope.password);
var w = walletFactory.open($rootScope.openedWalletId, { passphrase: passphrase});
controllerUtils.startNetwork(w);
};
});

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copay.setup').controller('SetupController',
function($scope, $rootScope, $location, walletFactory, controllerUtils) {
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) {
$scope.loading = false;
@ -33,13 +33,15 @@ angular.module('copay.setup').controller('SetupController',
$scope.create = function(totalCopayers, requiredCopayers, walletName, myNickname) {
$scope.loading = true;
var passphrase = Passphrase.getBase64($scope.walletPassword);
var opts = {
requiredCopayers: requiredCopayers,
totalCopayers: totalCopayers,
name: walletName,
nickname: myNickname,
passphrase: passphrase,
};
console.log('[setup.js.31:opts:]',opts); //TODO
var w = walletFactory.create(opts);
controllerUtils.startNetwork(w);
};

View File

@ -12,10 +12,11 @@ angular.module('copay.signin').controller('SigninController',
$location.path('setup');
};
$scope.open = function(walletId, opts) {
$scope.open = function(walletId) {
$scope.loading = true;
var w = walletFactory.open(walletId, opts);
controllerUtils.startNetwork(w);
$rootScope.openedWalletId = walletId;
$location.path('password');
};
$scope.join = function(secret, nickname ) {