feature: Logout wallet after 15 minutes of inactivity
This commit is contained in:
parent
010c13fa4f
commit
f704826a5c
5 changed files with 24 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('SidebarController',
|
||||
function($scope, $rootScope, $sce, $location, $http, notification, controllerUtils) {
|
||||
function($scope, $rootScope, $sce, $location, $http, $idle, notification, controllerUtils) {
|
||||
|
||||
$scope.version = copay.version;
|
||||
$scope.networkName = config.networkName;
|
||||
|
|
@ -82,4 +82,18 @@ angular.module('copayApp.controllers').controller('SidebarController',
|
|||
// Init socket handlers (with no wallet yet)
|
||||
controllerUtils.setSocketHandlers();
|
||||
|
||||
if ($rootScope.wallet) {
|
||||
$idle.watch();
|
||||
|
||||
$scope.$on('$idleStart', function(a) {
|
||||
notification.warning('Timing', 'You were enought time in inactivity. This session will be closed in 10 seconds if continues without activity');
|
||||
});
|
||||
|
||||
$scope.$on('$idleTimeout', function() {
|
||||
$idle.unwatch();
|
||||
$scope.signout();
|
||||
notification.warning('Session closed', 'Session closed for a long time of inactivity');
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue