added password support to UI/Controllers

This commit is contained in:
Mario Colque 2014-05-01 09:59:43 -03:00
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"> ng-options="requiredCopayers as requiredCopayers for requiredCopayers in RCValues">
</select> </select>
</div> </div>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v"> <div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
@ -230,6 +229,12 @@
</div> </div>
</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="row">
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v"> <div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Wallet name (optional)</h6> <h6>Wallet name (optional)</h6>
@ -240,7 +245,6 @@
<input ng-model="myNickname" placeholder="" class="size-24" style="width:100%"> <input ng-model="myNickname" placeholder="" class="size-24" style="width:100%">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="large-12 columns line-dashed"> <div class="large-12 columns line-dashed">
<button class="button primary radius right" type="button" <button class="button primary radius right" type="button"
@ -258,8 +262,8 @@
<div class="" ng-controller="PasswordController"> <div class="" ng-controller="PasswordController">
<h3>Enter your password</h3> <h3>Enter your password</h3>
<div class="large-6 columns"> <div class="large-6 columns">
<input type="password" class="form-control" placeholder="Enter your passwor" ng-model="password" autofocus=""> <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> <button type="submit" class="button secondary round text-center" ng-click="getPassphrase()">Send</button>
</div> </div>
</div> </div>
</script> </script>
@ -328,7 +332,7 @@
</div> </div>
</div> </div>
</script> </script>
<!-- TRANSACTIONS --> <!-- TRANSACTIONS -->
<script type="text/ng-template" id="transactions.html"> <script type="text/ng-template" id="transactions.html">
<div class="transactions" data-ng-controller="TransactionsController"> <div class="transactions" data-ng-controller="TransactionsController">

View file

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

View file

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