Merge pull request #298 from cmgustavo/feature/01-signin-related

Feature/01 signin related
This commit is contained in:
Matias Alejo Garcia 2014-05-06 15:37:34 -03:00
commit fc48d68ec9
5 changed files with 145 additions and 49 deletions

View file

@ -267,9 +267,6 @@ hr { margin: 2.25rem 0;}
.lh {line-height: 0;}
.oh {overflow:hidden;}
.lh {line-height: 0;}
.signin input.ng-dirty.ng-invalid {
border: 2px red solid;
}
.video-small {
width: 80px;

View file

@ -168,17 +168,94 @@ button.radius, .button.radius {
border-radius: 5px;
}
button.primary, button.secondary, button.primary:hover, button.secondary:hover {color: #fff !important;}
/* SECONDARY */
button.secondary,
.button.secondary {
background-color: #1ABC9C;
color: #fff;
}
button.secondary:hover,
button.secondary:focus,
.button.secondary:hover,
.button.secondary:focus {
background-color: #16A085;
color: #e6e6e6;
}
button.disabled.secondary,
button[disabled].secondary,
.button.disabled.secondary,
.button[disabled].secondary,
button.disabled.secondary:hover,
button.disabled.secondary:focus,
button[disabled].secondary:hover,
button[disabled].secondary:focus,
.button.disabled.secondary:hover,
.button.disabled.secondary:focus,
.button[disabled].secondary:hover,
.button[disabled].secondary:focus {
background-color: #1ABC9C;
color: #E6E6E6;
}
button.primary { background-color: #E67E22; }
button.secondary { background-color: #1ABC9C !important; }
button.warning { background-color: #C0392A; }
/* PRIMARY */
button.primary,
.button.primary {
background-color: #E67E22;
color: #fff;
}
button.primary:hover,
button.primary:focus,
.button.primary:hover,
.button.primary:focus {
background-color: #D86601;
color: #e6e6e6;
}
button.disabled.primary,
button[disabled].primary,
.button.disabled.primary,
.button[disabled].primary,
button.disabled.primary:hover,
button.disabled.primary:focus,
button[disabled].primary:hover,
button[disabled].primary:focus,
.button.disabled.primary:hover,
.button.disabled.primary:focus,
.button[disabled].primary:hover,
.button[disabled].primary:focus {
background-color: #E67E22;
color: #E6E6E6;
}
button.primary:hover { background-color: #D86601;}
button.secondary:hover { background-color: #16A085 !important;}
button.warning:hover { background-color: #82251A; }
/* WARNING */
button.warning,
.button.warning {
background-color: #C0392A;
color: #fff;
}
button.warning:hover,
button.warning:focus,
.button.warning:hover,
.button.warning:focus {
background-color: #82251A;
color: #e6e6e6;
}
button.disabled.warning,
button[disabled].warning,
.button.disabled.warning,
.button[disabled].warning,
button.disabled.warning:hover,
button.disabled.warning:focus,
button[disabled].warning:hover,
button[disabled].warning:focus,
.button.disabled.warning:hover,
.button.disabled.warning:focus,
.button[disabled].warning:hover,
.button[disabled].warning:focus {
background-color: #C0392A;
color: #E6E6E6;
}
.text-gray { color: #999 !important;}
.text-gray { color: #999;}
#footer {
background: #2C3E50;

View file

@ -143,38 +143,44 @@
</div>
<div ng-show="!loading">
<div class="row">
<div class="large-6 columns">
<div class="box-signin">
<h3>Join a Wallet in Creation</h3>
<input type="text" class="form-control" placeholder="Paste wallet secret here" ng-model="connectionId" required autofocus>
<input type="password" class="form-control" placeholder="Your wallet password" ng-model="joinPassword">
<input type="text" class="form-control" placeholder="Your name (optional)" ng-model="nickname">
<button class="button primary expand radius" ng-click="join()" ng-disabled="loading" loading="Joining">Join</button>
</div>
</div>
<div class="large-6 columns">
<div class="large-6 medium-6 columns">
<div class="box-signin">
<div ng-show="wallets.length">
<h3>Open Wallet</h3>
<select class="form-control" ng-model="selectedWalletId" ng-options="w.id as w.show for w in wallets">
</select>
<input type="password" class="form-control" placeholder="Your wallet password" ng-model="openPassword">
<button class="button secondary expand radius" type="button" ng-click="open()" ng-disabled="loading" loading="Opening">Open</button>
<form name="openForm" ng-submit="open(openForm)" novalidate>
<select class="form-control" ng-model="selectedWalletId" ng-options="w.id as w.show for w in wallets" required>
</select>
<input type="password" class="form-control" placeholder="Your wallet password" name="openPassword" ng-model="openPassword" required>
<button type="submit" class="button secondary radius" ng-disabled="openForm.$invalid || loading" loading="Opening">Open</button>
</form>
</div>
<div ng-show="!wallets.length">
<h3>Create a new wallet</h3>
<input type="text" class="form-control" ng-model="walletName" placeholder="Wallet name (optional)">
<input type="password" class="form-control" placeholder="Your wallet password" ng-model="createPassword">
<button class="button secondary expand radius" ng-click="create()" ng-disabled="loading" loading="Creating">Create</button>
<form name="createForm" ng-submit="create(createForm)" novalidate>
<input type="text" class="form-control" ng-model="walletName" name="walletName" placeholder="Wallet name (optional)">
<input type="password" class="form-control" placeholder="Your wallet password" name="createPassword" ng-model="createPassword" required>
<button type="submit" class="button secondary radius" ng-disabled="createForm.$invalid || loading" loading="Creating">Create</button>
</form>
</div>
</div>
</div>
<div class="large-6 medium-6 columns">
<div class="box-signin">
<h3>Join a Wallet in Creation</h3>
<form name="joinForm" ng-submit="join(joinForm)" novalidate>
<input type="text" class="form-control" placeholder="Paste wallet secret here" name="connectionId" ng-model="connectionId" required>
<input type="password" class="form-control" placeholder="Your wallet password" name="joinPassword" ng-model="joinPassword" required>
<input type="text" class="form-control" placeholder="Your name (optional)" name="nickname" ng-model="nickname">
<button type="submit" class="button primary radius" ng-disabled="joinForm.$invalid || loading" loading="Joining">Join</button>
</form>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns text-center line-dashed">
<span ng-show="wallets.length">
<a ng-click="create()" ng-disabled="loading" loading="Creating">Create a new wallet</a> &middot;
<a href="#/setup">Create a new wallet</a> &middot;
</span>
<a ng-href="#import">Import from file</a>
</div>
@ -203,6 +209,7 @@
Creating new wallet...
</div>
<div ng-show="!loading">
<form name="setupForm" ng-submit="create(setupForm)" novalidate>
<div class="row">
<div class="small-12 medium-8 medium-centered large-8 large-centered columns box-setup">
<div class="large-6 columns line-dashed-v">
@ -226,27 +233,27 @@
</div>
</div>
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Wallet Password</h6>
<h6>Wallet Password <small>Required</small></h6>
<input type="password" class="form-control" ng-model="walletPassword" required>
</div>
<div class="small-12 medium-6 medium-centered large-6 large-centered columns m30v">
<h6>Wallet name <small>(optional)</small></h6>
<h6>Wallet name <small>Optional</small></h6>
<input type="text" class="form-control" ng-model="walletName">
</div>
<div class="large-6 large-centered columns m30v">
<h6>Your name <small>(optional)</small></h6>
<h6>Your name <small>Optional</small></h6>
<input type="text" class="form-control" ng-model="myNickname">
</div>
</div>
<div class="row">
<div class="large-12 columns line-dashed">
<button class="button primary radius right" type="button"
ng-click="create()">
<button type="submit" class="button primary radius right" ng-disabled="setupForm.$invalid || loading">
Create {{requiredCopayers}}-of-{{totalCopayers}} wallet
</button>
<a class="button secondary radius" href="#signin">Go back</a>
</div>
</div>
</form>
</div>
</div>
</script>

View file

@ -32,7 +32,12 @@ angular.module('copay.setup').controller('SetupController',
updateRCSelect(tc);
});
$scope.create = function() {
$scope.create = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$scope.loading = true;
var passphrase = Passphrase.getBase64($scope.walletPassword);

View file

@ -7,25 +7,35 @@ angular.module('copay.signin').controller('SigninController',
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
$scope.openPassword = '';
$scope.create = function() {
$scope.loading = true;
$scope.create = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$rootScope.walletName = $scope.walletName;
$rootScope.walletPassword = $scope.createPassword;
$rootScope.walletName = form.walletName.$modelValue;
$rootScope.walletPassword = form.createPassword.$modelValue;
$location.path('setup');
};
$scope.open = function() {
if ($scope.openPassword != '') {
$scope.loading = true;
var passphrase = Passphrase.getBase64($scope.openPassword);
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
controllerUtils.startNetwork(w);
$scope.open = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$scope.loading = true;
var password = form.openPassword.$modelValue;
var passphrase = Passphrase.getBase64(password);
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
controllerUtils.startNetwork(w);
};
$scope.join = function() {
$scope.join = function(form) {
if (form && form.$invalid) {
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$scope.loading = true;
walletFactory.network.on('badSecret', function() {