login initial foxed

This commit is contained in:
Tankred Hase 2013-11-11 13:28:05 +01:00
parent ccbbd5b182
commit 691e434c49
2 changed files with 13 additions and 10 deletions

View File

@ -8,12 +8,15 @@ define(function(require) {
var emailDao = appController._emailDao,
states;
$scope.states = states = {
// global state... inherited to all child scopes
$scope.$root.state = {};
states = {
IDLE: 1,
PROCESSING: 2,
DONE: 4
};
$scope.state = states.IDLE; // initial state
$scope.state.ui = states.IDLE; // initial state
//
@ -21,8 +24,8 @@ define(function(require) {
//
$scope.confirmPassphrase = function() {
var passphrase = $scope.passphrase,
confirmation = $scope.confirmation;
var passphrase = $scope.state.passphrase,
confirmation = $scope.state.confirmation;
if (!passphrase || passphrase !== confirmation) {
return;
@ -73,7 +76,7 @@ define(function(require) {
};
function setState(state, async) {
$scope.state = state;
$scope.state.ui = state;
if (async) {
$scope.$apply();

View File

@ -1,21 +1,21 @@
<div class="view-login" ng-class="{'waiting-cursor': state === states.PROCESSING}">
<div class="view-login" ng-class="{'waiting-cursor': state.ui === 2}">
<div class="logo-wrapper">
<div class="logo"></div>
</div><!--/logo-->
<div class="content" ng-switch on="state">
<div class="content" ng-switch on="state.ui">
<div ng-switch-when="1">
<h1>Set passphrase</h1>
<p>This is used to protect your keypair. If you forget your passphrase, there is no way to restore your data.</p>
<form>
<div>
<input type="password" ng-model="passphrase" placeholder="Enter passphrase" tabindex="1" focus-me="true">
<input type="password" ng-model="confirmation" ng-class="{error: confirmation !== passphrase}" placeholder="Confirm passphrase" tabindex="2">
<input type="password" ng-model="state.passphrase" placeholder="Enter passphrase" tabindex="1" focus-me="true">
<input type="password" ng-model="state.confirmation" ng-class="{error: state.confirmation !== state.passphrase}" placeholder="Confirm passphrase" tabindex="2">
</div>
<div>
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!passphrase || passphrase!==confirmation" tabindex="3">Generate keypair</button>
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!state.passphrase || state.passphrase !== state.confirmation" tabindex="3">Generate keypair</button>
</div>
</form>
</div>