mirror of https://github.com/keeweb/keeweb.git
fix #795: inputs validation in file settings
This commit is contained in:
parent
688e363c89
commit
8561756335
|
@ -494,6 +494,9 @@ const SettingsFileView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
changeHistoryLength: function(e) {
|
||||
if (!e.target.validity.valid) {
|
||||
return;
|
||||
}
|
||||
const value = +e.target.value;
|
||||
if (isNaN(value)) {
|
||||
e.target.value = this.model.get('historyMaxItems');
|
||||
|
@ -503,6 +506,9 @@ const SettingsFileView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
changeHistorySize: function(e) {
|
||||
if (!e.target.validity.valid) {
|
||||
return;
|
||||
}
|
||||
const value = +e.target.value;
|
||||
if (isNaN(value)) {
|
||||
e.target.value = this.model.get('historyMaxSize') / 1024 / 1024;
|
||||
|
@ -512,6 +518,9 @@ const SettingsFileView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
changeKeyRounds: function(e) {
|
||||
if (!e.target.validity.valid) {
|
||||
return;
|
||||
}
|
||||
const value = +e.target.value;
|
||||
if (isNaN(value)) {
|
||||
e.target.value = this.model.get('keyEncryptionRounds');
|
||||
|
@ -521,6 +530,9 @@ const SettingsFileView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
changeKeyChangeForce: function(e) {
|
||||
if (!e.target.validity.valid) {
|
||||
return;
|
||||
}
|
||||
let value = Math.round(e.target.value);
|
||||
if (isNaN(value) || value <= 0) {
|
||||
value = -1;
|
||||
|
@ -529,6 +541,9 @@ const SettingsFileView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
changeKdfParameter: function(e) {
|
||||
if (!e.target.validity.valid) {
|
||||
return;
|
||||
}
|
||||
const field = $(e.target).data('field');
|
||||
const mul = $(e.target).data('mul') || 1;
|
||||
const value = e.target.value * mul;
|
||||
|
|
|
@ -103,14 +103,14 @@
|
|||
<label for="settings__file-trash">{{res 'setFileEnableTrash'}}</label>
|
||||
</div>
|
||||
<label for="settings__file-hist-len">{{res 'setFileHistLen'}}:</label>
|
||||
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-hist-len" value="{{historyMaxItems}}" />
|
||||
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-hist-len" value="{{historyMaxItems}}" maxlength="6" />
|
||||
<label for="settings__file-hist-size">{{res 'setFileHistSize'}}:</label>
|
||||
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-hist-size" value="{{historyMaxSize}}" />
|
||||
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-hist-size" value="{{historyMaxSize}}" maxlength="3" />
|
||||
|
||||
<h2>{{res 'advanced'}}</h2>
|
||||
{{#if keyEncryptionRounds}}
|
||||
<label for="settings__file-key-rounds">{{res 'setFileRounds'}}:</label>
|
||||
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-key-rounds" value="{{keyEncryptionRounds}}" />
|
||||
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-key-rounds" value="{{keyEncryptionRounds}}" maxlength="10" />
|
||||
{{else if kdfParameters}}
|
||||
<label>{{res 'setFileKdfParams'}}: Argon2</label>
|
||||
<div class="settings__row">
|
||||
|
@ -133,5 +133,5 @@
|
|||
{{/if}}
|
||||
|
||||
<label for="settings__file-key-change-force">{{res 'setFileKeyChangeForce'}}:</label>
|
||||
<input type="text" pattern="\d*" class="settings__input input-base" id="settings__file-key-change-force" value="{{keyChangeForce}}" />
|
||||
<input type="text" pattern="\d*" class="settings__input input-base" id="settings__file-key-change-force" value="{{keyChangeForce}}" maxlength="6" />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue