pin fixes
This commit is contained in:
parent
e3f2a71a53
commit
d3128137ce
8 changed files with 91 additions and 65 deletions
|
|
@ -548,6 +548,7 @@ a.button-setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
.dn {display: none;}
|
.dn {display: none;}
|
||||||
|
.dni {display: none !important;}
|
||||||
.pr {position: relative;}
|
.pr {position: relative;}
|
||||||
.pa {position: absolute;}
|
.pa {position: absolute;}
|
||||||
.m0 {margin: 0;}
|
.m0 {margin: 0;}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<nav class="tab-bar" ng-if="$root.iden" >
|
<nav class="tab-bar" ng-if="$root.iden && !$root.hideNavigation" >
|
||||||
<section class="left-small">
|
<section class="left-small">
|
||||||
<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
|
<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -92,7 +92,9 @@
|
||||||
ng-controller="HeadController"
|
ng-controller="HeadController"
|
||||||
class="head show-for-large-up"
|
class="head show-for-large-up"
|
||||||
ng-include="'views/includes/head.html'"
|
ng-include="'views/includes/head.html'"
|
||||||
ng-if="$root.iden"></div>
|
ng-if="$root.iden"
|
||||||
|
ng-class="{'dni':$root.hideNavigation}"
|
||||||
|
></div>
|
||||||
|
|
||||||
<section ng-class="{'main':$root.iden && !$root.starting}" ng-view></section>
|
<section ng-class="{'main':$root.iden && !$root.starting}" ng-view></section>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('HeadController', function($scope, $rootScope, $filter, $timeout, notification, identityService, balanceService, pinService) {
|
angular.module('copayApp.controllers').controller('HeadController', function($scope, $rootScope, $filter, $timeout, notification, identityService, balanceService) {
|
||||||
$scope.username = $rootScope.iden.getName();
|
$scope.username = $rootScope.iden.getName();
|
||||||
$scope.hoverMenu = false;
|
$scope.hoverMenu = false;
|
||||||
|
|
||||||
|
|
@ -39,15 +39,10 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
||||||
window.onbeforeunload = undefined;
|
window.onbeforeunload = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO put this on init()
|
$scope.init = function() {
|
||||||
if ($rootScope.wallet) {
|
if (!$rootScope.wallet) return;
|
||||||
pinService.check(function(err, value) {
|
|
||||||
$scope.hasPin = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
$scope.$on('$idleStart', function() {});
|
||||||
$scope.$on('$idleStart', function() {
|
|
||||||
});
|
|
||||||
$scope.$on('$idleWarn', function(a, countdown) {
|
$scope.$on('$idleWarn', function(a, countdown) {
|
||||||
$rootScope.countdown = countdown;
|
$rootScope.countdown = countdown;
|
||||||
$rootScope.sessionExpired = true;
|
$rootScope.sessionExpired = true;
|
||||||
|
|
@ -70,5 +65,5 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
|
||||||
$rootScope.$watch('title', function(newTitle, oldTitle) {
|
$rootScope.$watch('title', function(newTitle, oldTitle) {
|
||||||
$scope.title = newTitle;
|
$scope.title = newTitle;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, $timeout, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
|
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, $timeout, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
|
||||||
|
|
||||||
|
|
||||||
|
var _credentials;
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
// This is only for backwards compat, insight api should link to #!/confirmed directly
|
// This is only for backwards compat, insight api should link to #!/confirmed directly
|
||||||
if (getParam('confirmed')) {
|
if (getParam('confirmed')) {
|
||||||
|
|
@ -15,16 +18,14 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
$rootScope.fromEmailConfirmation = false;
|
$rootScope.fromEmailConfirmation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rootScope.iden) {
|
if ($rootScope.iden) {
|
||||||
identityService.goWalletHome();
|
identityService.goWalletHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
Compatibility.check($scope);
|
Compatibility.check($scope);
|
||||||
if (isMobile.any()) {
|
pinService.check(function(err, value) {
|
||||||
pinService.check(function(err, value) {
|
$rootScope.hasPin = value;
|
||||||
$scope.hasPin = value;
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.defineProperty($scope,
|
Object.defineProperty($scope,
|
||||||
|
|
@ -72,9 +73,8 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
if ($scope.$$childTail._newpin === newValue) {
|
if ($scope.$$childTail._newpin === newValue) {
|
||||||
// save and submit
|
// save and submit
|
||||||
$scope.createPin($scope.$$childTail.setPinForm);
|
$scope.createPin($scope.$$childTail.setPinForm);
|
||||||
}
|
} else {
|
||||||
else {
|
$scope.error = 'Entered PINs were not equal. Try again';
|
||||||
$scope.error = 'Pin must match!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!newValue) {
|
if (!newValue) {
|
||||||
|
|
@ -119,11 +119,28 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.openWallets = function() {
|
||||||
|
preconditions.checkState($rootScope.iden);
|
||||||
|
var iden = $rootScope.iden;
|
||||||
|
|
||||||
|
$rootScope.hideNavigation = false;
|
||||||
|
$rootScope.starting = true;
|
||||||
|
iden.on('newWallet', $scope.done);
|
||||||
|
iden.on('noWallets', $scope.done);
|
||||||
|
iden.openWallets();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.createPin = function(form) {
|
$scope.createPin = function(form) {
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
|
preconditions.checkState($rootScope.iden);
|
||||||
|
preconditions.checkState(_credentials && _credentials.email);
|
||||||
|
|
||||||
pinService.save(form.repeatpin.$modelValue, $scope.email, $scope.password, function(err) {
|
pinService.save(form.repeatpin.$modelValue, _credentials.email, _credentials.password, function(err) {
|
||||||
$scope.open($scope.email, $scope.password);
|
_credentials.password = '';
|
||||||
|
_credentials = null;
|
||||||
|
$rootScope.hasPin = true;
|
||||||
|
$scope.openWallets();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -133,12 +150,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
$scope.error = 'Please enter the required fields';
|
$scope.error = 'Please enter the required fields';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isMobile.any() && !$scope.hasPin) {
|
|
||||||
$scope.email = form.email.$modelValue;
|
|
||||||
$scope.password = form.password.$modelValue;
|
|
||||||
$scope.setPin = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.open(form.email.$modelValue, form.password.$modelValue);
|
$scope.open(form.email.$modelValue, form.password.$modelValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -146,7 +158,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
$scope.pinLogout = function() {
|
$scope.pinLogout = function() {
|
||||||
pinService.clear(function() {
|
pinService.clear(function() {
|
||||||
copay.logger.debug('PIN erased');
|
copay.logger.debug('PIN erased');
|
||||||
$scope.hasPin = null;
|
delete $rootScope['hasPin'];
|
||||||
applicationService.reload();
|
applicationService.reload();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -169,13 +181,32 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
} else {
|
} else {
|
||||||
$scope.error = 'Unknown error';
|
$scope.error = 'Unknown error';
|
||||||
}
|
}
|
||||||
return $scope.done();
|
$rootScope.starting = false;
|
||||||
|
$rootScope.$digest();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open successfully?
|
||||||
if (iden) {
|
if (iden) {
|
||||||
iden.on('newWallet', $scope.done);
|
|
||||||
iden.on('noWallets', $scope.done);
|
// mobile
|
||||||
iden.openWallets();
|
//if (isMobile.any() && !$rootScope.hasPin) {
|
||||||
|
if (true && !$rootScope.hasPin) {
|
||||||
|
$scope.done();
|
||||||
|
_credentials = {
|
||||||
|
email: email,
|
||||||
|
password: password,
|
||||||
|
};
|
||||||
|
$scope.askForPin = true;
|
||||||
|
$rootScope.starting = false;
|
||||||
|
$rootScope.hideNavigation = true;
|
||||||
|
$rootScope.$digest();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// no mobile
|
||||||
|
else {
|
||||||
|
$scope.openWallets();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, $timeout, identityService, pinService) {
|
angular.module('copayApp.controllers').controller('SidebarController', function($scope, $rootScope, $location, $timeout, identityService) {
|
||||||
|
|
||||||
$scope.menu = [{
|
$scope.menu = [{
|
||||||
'title': 'Home',
|
'title': 'Home',
|
||||||
|
|
@ -80,9 +80,6 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
|
||||||
$scope.walletSelection = false;
|
$scope.walletSelection = false;
|
||||||
$scope.setWallets();
|
$scope.setWallets();
|
||||||
});
|
});
|
||||||
pinService.check(function(err, value) {
|
|
||||||
$scope.hasPin = value;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="large-4 large-centered medium-7 medium-centered columns" ng-show="!$root.starting">
|
<div class="large-4 large-centered medium-7 medium-centered columns" ng-show="!$root.starting">
|
||||||
<div class="logo-setup">
|
<div class="logo-setup" ng-show="!$root.iden">
|
||||||
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
|
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
|
||||||
<div ng-include="'views/includes/version.html'"></div>
|
<div ng-include="'views/includes/version.html'"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -47,8 +47,10 @@
|
||||||
<a class="text-white" href="#!/createProfile">creating your profile</a>
|
<a class="text-white" href="#!/createProfile">creating your profile</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box-setup" ng-if="setPin" ng-init="secondPin = false">
|
<div class="box-setup" ng-if="askForPin" ng-init="secondPin = false">
|
||||||
<h1><span translate>Set your </span> <b> PIN number</b></h1>
|
<h1><span translate>Set up a </span> <b> PIN </b>?</h1>
|
||||||
|
<p class="size-14"> Enter a 4-digit number for easier access from this device
|
||||||
|
|
||||||
<div class="box-notification" ng-show="error">
|
<div class="box-notification" ng-show="error">
|
||||||
<div class="box-icon error">
|
<div class="box-icon error">
|
||||||
<i class="fi-x size-24"></i>
|
<i class="fi-x size-24"></i>
|
||||||
|
|
@ -63,14 +65,14 @@
|
||||||
<input id="newpin" type="tel" ng-model="newpin" class="form-control"
|
<input id="newpin" type="tel" ng-model="newpin" class="form-control"
|
||||||
ng-maxlength="4" ng-minlength="4" maxlength="4"
|
ng-maxlength="4" ng-minlength="4" maxlength="4"
|
||||||
ng-pattern="/^[0-9]{1,4}$/"
|
ng-pattern="/^[0-9]{1,4}$/"
|
||||||
placeholder="Pin number" name="newpin" required show-focus="!secondPin">
|
placeholder="PIN" name="newpin" required show-focus="!secondPin">
|
||||||
<i class="icon-locked"></i>
|
<i class="icon-locked"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="input" ng-show="secondPin">
|
<div class="input" ng-show="secondPin">
|
||||||
<input id="repeatpin" type="tel" ng-model="repeatpin" class="form-control"
|
<input id="repeatpin" type="tel" ng-model="repeatpin" class="form-control"
|
||||||
ng-maxlength="4" ng-minlength="4" maxlength="4"
|
ng-maxlength="4" ng-minlength="4" maxlength="4"
|
||||||
ng-pattern="/^[0-9]{1,4}$/"
|
ng-pattern="/^[0-9]{1,4}$/"
|
||||||
placeholder="Repeat pin number" name="repeatpin" required show-focus="secondPin">
|
placeholder="Confirm your PIN" name="repeatpin" required show-focus="secondPin">
|
||||||
<i class="icon-locked"></i>
|
<i class="icon-locked"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -80,23 +82,22 @@
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="box-setup-footer row collapse">
|
<div class="box-setup-footer row collapse">
|
||||||
<div class="large-6 medium-6 small-6 columns">
|
<div class="large-6 medium-6 small-6 columns text-right">
|
||||||
<a class="button warning radius m0" ng-click="pinLogout()">
|
<a class="button secondary radius m0" ng-click="openWallets()">
|
||||||
<span translate>Cancel</span>
|
<span translate>Skip</span>
|
||||||
<i class="icon-x"></i>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-6 medium-6 small-6 columns text-right">
|
<div class="large-6 medium-6 small-6 columns text-right">
|
||||||
<a class="button secondary radius m0" ng-click="open(email, password)">
|
<a class="button secondary radius m0">
|
||||||
<span translate>Skip</span>
|
<span translate>OK</span>
|
||||||
<i class="icon-arrow-right3"></i>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box-setup" ng-if='hasPin'>
|
<div class="box-setup" ng-if='$root.hasPin'>
|
||||||
<h1><span translate>Enter your </span> <b> PIN number</b></h1>
|
<h1><span translate>Enter your </span> <b> PIN</b></h1>
|
||||||
<form name="pinForm" ng-submit="openWithPin(pinForm)" novalidate>
|
<form name="pinForm" ng-submit="openWithPin(pinForm)" novalidate>
|
||||||
<div class="box-notification" ng-show="error">
|
<div class="box-notification" ng-show="error">
|
||||||
<div class="box-icon error">
|
<div class="box-icon error">
|
||||||
|
|
@ -129,7 +130,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="box-setup" ng-if='!hasPin && !setPin'>
|
<div class="box-setup" ng-if='!$root.hasPin && !askForPin'>
|
||||||
<h1><span translate>Sign in to</span> <b>Copay</b></h1>
|
<h1><span translate>Sign in to</span> <b>Copay</b></h1>
|
||||||
<form name="loginForm" ng-submit="openWithCredentials(loginForm)" novalidate>
|
<form name="loginForm" ng-submit="openWithCredentials(loginForm)" novalidate>
|
||||||
<p class="text-warning size-12"
|
<p class="text-warning size-12"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h1>
|
<h1>
|
||||||
{{$root.title}}
|
{{$root.title}}
|
||||||
<small>
|
<small ng-if="$root.wallet">
|
||||||
<a class="text-gray" ng-click="refresh()" ng-if="!$root.updatingBalance">
|
<a class="text-gray" ng-click="refresh()" ng-if="!$root.updatingBalance">
|
||||||
<i class="fi-refresh"></i>
|
<i class="fi-refresh"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="menu" ng-mouseover="hoverIn()" ng-mouseleave="hoverOut()"
|
<div class="menu" ng-mouseover="hoverIn()" ng-mouseleave="hoverOut()" ng-init="init()" ng-click="hoverMenu = !hoverMenu">
|
||||||
ng-click="hoverMenu = !hoverMenu">
|
|
||||||
<a class="dropdown ellipsis text-gray pr" ng-class="{'hover': hoverMenu}">
|
<a class="dropdown ellipsis text-gray pr" ng-class="{'hover': hoverMenu}">
|
||||||
<div class="photo-container">
|
<div class="photo-container">
|
||||||
<img gravatar-src="'{{username}}'" gravatar-size="35">
|
<img gravatar-src="'{{username}}'" gravatar-size="35">
|
||||||
|
|
@ -39,8 +38,8 @@
|
||||||
<i class="icon-person size-18 m10r"></i> {{'Profile'|translate}}<span class="size-10 text-warning" ng-if="!$root.needsEmailConfirmation && $root.iden.backupNeeded"> [ Needs Backup ]</span></a>
|
<i class="icon-person size-18 m10r"></i> {{'Profile'|translate}}<span class="size-10 text-warning" ng-if="!$root.needsEmailConfirmation && $root.iden.backupNeeded"> [ Needs Backup ]</span></a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#!/" title="Close" ng-click="signout()">
|
<li><a href="#!/" title="Close" ng-click="signout()">
|
||||||
<span ng-if="!hasPin"><i class="icon-power size-18 m10r"></i> {{'Close'|translate}}</span>
|
<span ng-if="!$root.hasPin"><i class="icon-power size-18 m10r"></i> {{'Close'|translate}}</span>
|
||||||
<span ng-if="hasPin"><i class="icon-power size-18 m10r"></i> {{'Lock'|translate}}</span>
|
<span ng-if="$root.hasPin"><i class="fi-lock size-18 m10r"></i> {{'Lock'|translate}}</span>
|
||||||
</a></li>
|
</a></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div ng-controller="SidebarController" ng-init="init()">
|
<div ng-controller="SidebarController" ng-init="init()">
|
||||||
<header>
|
<header>
|
||||||
<div ng-click="toggleWalletSelection()">
|
<div ng-click="toggleWalletSelection()" ng-if="$root.wallet">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<div class="avatar-wallet">{{$root.wallet.getName() | limitTo: 1}}</div>
|
<div class="avatar-wallet">{{$root.wallet.getName() | limitTo: 1}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -95,15 +95,15 @@
|
||||||
<a href="#!/import" class="db p20h nav-item" title="Import wallet">
|
<a href="#!/import" class="db p20h nav-item" title="Import wallet">
|
||||||
<i class="size-24 m20r fi-download"></i> {{'Import a wallet' | translate }} </a>
|
<i class="size-24 m20r fi-download"></i> {{'Import a wallet' | translate }} </a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li ng-if="$root.wallet">
|
||||||
<a href="#!/more" class="db p20h nav-item" title="Settings">
|
<a href="#!/more" class="db p20h nav-item" title="Settings" >
|
||||||
<i class="size-24 m20r fi-widget"></i> {{'Settings' | translate }} </a>
|
<i class="size-24 m20r fi-widget"></i> {{'Wallet Settings' | translate }} </a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#!/" class="db p20h nav-item" title="Close"
|
<a href="#!/" class="db p20h nav-item" title="Close"
|
||||||
ng-click="signout()">
|
ng-click="signout()">
|
||||||
<span ng-if="!hasPin"><i class="size-24 m20r fi-power"></i> {{'Close'|translate}}</span>
|
<span ng-if="!$root.hasPin"><i class="size-24 m20r fi-power"></i> {{'Close'|translate}}</span>
|
||||||
<span ng-if="hasPin"><i class="size-24 m20r fi-lock"></i> {{'Lock'|translate}}</span>
|
<span ng-if="$root.hasPin"><i class="size-24 m20r fi-lock"></i> {{'Lock'|translate}}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue