mirror of https://github.com/keeweb/keeweb.git
fix #37: auto-lock by timer
This commit is contained in:
parent
7b4791371e
commit
b2e638bb1a
2
TODO.md
2
TODO.md
|
@ -3,7 +3,7 @@
|
|||
## v0.4
|
||||
Nov
|
||||
- [x] desktop dropbox
|
||||
- [ ] lock flow, auto-lock
|
||||
- [x] lock flow, auto-lock
|
||||
- [ ] minimize to tray
|
||||
- [ ] trim history by rules
|
||||
- [ ] custom icons, favicons
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
var ModalView = require('../views/modal-view');
|
||||
|
||||
var Alerts = {
|
||||
alertDisplayed: false,
|
||||
|
||||
buttons: {
|
||||
ok: {result: 'yes', title: 'OK'},
|
||||
yes: {result: 'yes', title: 'Yes'},
|
||||
|
@ -10,9 +12,11 @@ var Alerts = {
|
|||
},
|
||||
|
||||
alert: function(config) {
|
||||
Alerts.alertDisplayed = true;
|
||||
var view = new ModalView({ model: config });
|
||||
view.render();
|
||||
view.on('result', function(res, check) {
|
||||
Alerts.alertDisplayed = false;
|
||||
if (res && config.success) {
|
||||
config.success(res, check);
|
||||
}
|
||||
|
|
|
@ -259,7 +259,9 @@ var AppView = Backbone.View.extend({
|
|||
|
||||
lockWorkspace: function(autoInit) {
|
||||
var that = this;
|
||||
// TODO: check if visual lock or any alert is displayed and stop, if any
|
||||
if (Alerts.alertDisplayed) { // TODO: check visual lock as well
|
||||
return;
|
||||
}
|
||||
if (this.model.files.hasUnsavedFiles()) {
|
||||
if (this.model.settings.get('autoSave')) {
|
||||
this.saveAndLock(autoInit);
|
||||
|
@ -300,6 +302,7 @@ var AppView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
saveAndLock: function(autoInit) {
|
||||
// TODO: move to file manager
|
||||
var pendingCallbacks = 0,
|
||||
errorFiles = [],
|
||||
that = this;
|
||||
|
|
|
@ -16,6 +16,7 @@ var SettingsGeneralView = Backbone.View.extend({
|
|||
'change .settings__general-theme': 'changeTheme',
|
||||
'change .settings__general-expand': 'changeExpandGroups',
|
||||
'change .settings__general-auto-update': 'changeAutoUpdate',
|
||||
'change .settings__general-idle-minutes': 'changeIdleMinutes',
|
||||
'change .settings__general-clipboard': 'changeClipboard',
|
||||
'change .settings__general-auto-save': 'changeAutoSave',
|
||||
'click .settings__general-update-btn': 'checkUpdate',
|
||||
|
@ -44,6 +45,7 @@ var SettingsGeneralView = Backbone.View.extend({
|
|||
canClearClipboard: !!Launcher,
|
||||
clipboardSeconds: AppSettingsModel.instance.get('clipboardSeconds'),
|
||||
autoSave: AppSettingsModel.instance.get('autoSave'),
|
||||
idleMinutes: AppSettingsModel.instance.get('idleMinutes'),
|
||||
devTools: Launcher && Launcher.devTools,
|
||||
canAutoUpdate: !!Launcher,
|
||||
autoUpdate: Updater.getAutoUpdateType(),
|
||||
|
@ -102,6 +104,11 @@ var SettingsGeneralView = Backbone.View.extend({
|
|||
AppSettingsModel.instance.set('clipboardSeconds', clipboardSeconds);
|
||||
},
|
||||
|
||||
changeIdleMinutes: function(e) {
|
||||
var idleMinutes = +e.target.value;
|
||||
AppSettingsModel.instance.set('idleMinutes', idleMinutes);
|
||||
},
|
||||
|
||||
changeAutoUpdate: function(e) {
|
||||
var autoUpdate = e.target.value || false;
|
||||
AppSettingsModel.instance.set('autoUpdate', autoUpdate);
|
||||
|
|
|
@ -69,6 +69,16 @@
|
|||
<%- autoSave ? 'checked' : '' %> />
|
||||
<label for="settings__general-auto-save">Auto-save on lock</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="settings__general-idle-minutes">Auto-lock if the app is inactive:</label>
|
||||
<select class="settings__general-idle-minutes settings__select input-base" id="settings__general-idle-minutes">
|
||||
<option value="0" <%= idleMinutes <= 0 ? 'selected' : '' %>>Don't auto-lock</option>
|
||||
<option value="5" <%= idleMinutes === 5 ? 'selected' : '' %>>In 5 minutes</option>
|
||||
<option value="10" <%= idleMinutes === 10 ? 'selected' : '' %>>In 10 minutes</option>
|
||||
<option value="15" <%= idleMinutes === 15 ? 'selected' : '' %>>In 15 minutes</option>
|
||||
<option value="60" <%= idleMinutes === 60 ? 'selected' : '' %>>In an hour</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<% if (devTools) { %>
|
||||
<h2>Advanced</h2>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
Release notes
|
||||
-------------
|
||||
##### vNext
|
||||
Bugfixes
|
||||
Locking, better Dropbox, security enhancements, bugfixes
|
||||
`+` lock flow, auto-lock
|
||||
`-` fixed tag list scrolling
|
||||
`+` desktop Dropbox
|
||||
`+` Dropbox notification in self-hosted apps
|
||||
|
|
Loading…
Reference in New Issue