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