feature: Logout wallet after 15 minutes of inactivity

This commit is contained in:
Gustavo Maximiliano Cortez 2014-07-30 20:12:22 -03:00
commit f704826a5c
5 changed files with 24 additions and 3 deletions

View file

@ -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');
});
}
});