diff --git a/controller/translationcontroller.php b/controller/translationcontroller.php
index a60e6abd..a944c887 100644
--- a/controller/translationcontroller.php
+++ b/controller/translationcontroller.php
@@ -304,7 +304,7 @@ class TranslationController extends ApiController {
'revisions' => $this->trans->t('Revisions'),
'recover' => $this->trans->t('Recover'),
'destroy' => $this->trans->t('Destroy'),
-
+ 'use.regex' => $this->trans->t('Use regex'),
'sharereq.title' => $this->trans->t('You have incoming share requests.'),
'sharereq.line1' => $this->trans->t('If you want to put the credential in a other vault,'),
'sharereq.line2' => $this->trans->t('logout of this vault and login to the vault you want the shared credential in.'),
@@ -313,6 +313,7 @@ class TranslationController extends ApiController {
'date' => $this->trans->t('Date'),
'accept' => $this->trans->t('Accept'),
'decline' => $this->trans->t('Decline'),
+ 'session.time.left' => $this->trans->t('You have {{session_time}} left before logout.'),
// templates/views/vaults.html
'last.access' => $this->trans->t('Last accessed'),
@@ -329,6 +330,7 @@ class TranslationController extends ApiController {
'input.vault.password' => $this->trans->t('Please input the password for'),
'vault.default' => $this->trans->t('Set this vault as default.'),
'vault.auto.login' => $this->trans->t('Login automatically to this vault.'),
+ 'auto.logout' => $this->trans->t('Logout of this vault automatically after: '),
'vault.decrypt' => $this->trans->t('Decrypt vault'),
// templates/bookmarklet.php
diff --git a/css/app.css b/css/app.css
index f1e6e3e9..01c4364e 100644
--- a/css/app.css
+++ b/css/app.css
@@ -877,7 +877,7 @@
height: 200px; }
#app-settings-content:not(.ng-hide) {
- height: 60px;
+ height: 90px;
display: inherit !important;
padding: 0;
transition: height 0.15s ease-out; }
diff --git a/js/app/controllers/main.js b/js/app/controllers/main.js
index 78d97bb2..b8f2dbbd 100644
--- a/js/app/controllers/main.js
+++ b/js/app/controllers/main.js
@@ -31,7 +31,7 @@
* Controller of the passmanApp
*/
angular.module('passmanApp')
- .controller('MainCtrl', ['$scope', '$rootScope', '$location', 'SettingsService', function ($scope, $rootScope, $location, SettingsService) {
+ .controller('MainCtrl', ['$scope', '$rootScope', '$location', 'SettingsService', '$window', '$interval', '$filter', function ($scope, $rootScope, $location, SettingsService, $window, $interval, $filter) {
$scope.selectedVault = false;
$scope.http_warning_hidden = true;
@@ -63,6 +63,30 @@
$rootScope.$on('logout', function () {
$scope.selectedVault = false;
});
+
+ var tickSessionTimer = function(){
+ if($scope.session_time_left){
+ $scope.session_time_left--;
+ var session_time_left_formatted = $filter('toHHMMSS')($scope.session_time_left);
+ $scope.translationData = {
+ session_time: session_time_left_formatted
+ };
+ $rootScope.$broadcast('logout_timer_tick_tack', $scope.session_time_left);
+ if($scope.session_time_left === 0){
+ $window.location.reload();
+ }
+ }
+ };
+
+ $scope.session_time_left = false;
+ $scope.$on('logout_timer_set', function(evt, timer){
+ $scope.session_time_left = timer;
+ $scope.translationData = {
+ session_time: timer
+ };
+ $interval(tickSessionTimer, 1000);
+ });
+
}]);
}());
\ No newline at end of file
diff --git a/js/app/controllers/vault.js b/js/app/controllers/vault.js
index 99a868d4..08b3f7ca 100644
--- a/js/app/controllers/vault.js
+++ b/js/app/controllers/vault.js
@@ -67,6 +67,8 @@
$scope.default_vault = false;
$scope.remember_vault_password = false;
+ $scope.auto_logout_timer = false;
+ $scope.logout_timer = '0';
$scope.list_selected_vault = false;
$scope.minimal_value_key_strength = 3;
@@ -98,6 +100,10 @@
}
};
+ $scope.toggleAutoLogout = function(){
+ $scope.auto_logout_timer = !$scope.auto_logout_timer;
+ };
+
$scope.clearState = function () {
$scope.list_selected_vault = false;
$scope.creating_vault = false;
@@ -131,10 +137,20 @@
var _vault = angular.copy(vault);
_vault.vaultKey = angular.copy(vault_key);
delete _vault.credentials;
+ var timer = parseInt($scope.logout_timer);
+ if($scope.auto_logout_timer && timer > 0 ){
+ $rootScope.$broadcast('logout_timer_set', timer*60);
+ }
+
VaultService.setActiveVault(_vault);
$location.path('/vault/' + vault.guid);
};
+ $scope.selectLogoutTimer = function (time) {
+ $scope.auto_logout_timer = true;
+ $scope.logout_timer = time;
+ };
+
$scope.vaultDecryptionKey = '';
$scope.loginToVault = function (vault, vault_key) {
$scope.error = false;
diff --git a/js/app/filters/toHHMMSS.js b/js/app/filters/toHHMMSS.js
new file mode 100644
index 00000000..d7e4e4c2
--- /dev/null
+++ b/js/app/filters/toHHMMSS.js
@@ -0,0 +1,47 @@
+/**
+ * Nextcloud - passman
+ *
+ * @copyright Copyright (c) 2016, Sander Brand (brantje@gmail.com)
+ * @copyright Copyright (c) 2016, Marcos Zuriaga Miguel (wolfi@wolfi.es)
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
| {{ ::credential.label}} |