mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
The manualUrl.validity.valid check already checks for minlength. Add a maxlength attribute and remove javascript check.
This commit is contained in:
parent
57dfe26630
commit
cc8ce983f6
2 changed files with 30 additions and 31 deletions
|
|
@ -541,7 +541,7 @@
|
|||
<div class="form-group">
|
||||
<label for="manualUrl" data-i18n="optionsSitePreferencesManualAddText"></label>
|
||||
<div class="input-group" id="manualUrlGroup">
|
||||
<input class="form-control form-control-sm col-lg-10" type="url" id="manualUrl" aria-label="Manual URL" pattern="file://.*|ftp://.*|http://.*|https://.*" minlength="10" required>
|
||||
<input class="form-control form-control-sm col-lg-10" type="url" id="manualUrl" aria-label="Manual URL" pattern="file://.*|ftp://.*|http://.*|https://.*" minlength="10" maxlength="2000" required>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-primary" type="button" id="sitePreferencesManualAdd"><i class="fa fa-plus" aria-hidden="true"></i><span data-i18n="optionsButtonAdd"></span></button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -502,38 +502,37 @@ options.initSitePreferences = function() {
|
|||
|
||||
const errorMessage = tr('optionsErrorValueExists');
|
||||
let value = manualUrl.value;
|
||||
if (value.length > 10 && value.length <= 2000) {
|
||||
// Fills the last / char if needed. This ensures the compatibility with Match Patterns
|
||||
if (slashNeededForUrl(value)) {
|
||||
value += '/';
|
||||
}
|
||||
|
||||
// Check if the URL is already in the list
|
||||
if (options.settings['sitePreferences'].some(s => s.url === value)) {
|
||||
options.createWarning(manualUrl, errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.settings['sitePreferences'] === undefined) {
|
||||
options.settings['sitePreferences'] = [];
|
||||
}
|
||||
|
||||
const newValue = options.settings['sitePreferences'].length + 1;
|
||||
const trClone = $('#tab-site-preferences table tr.clone:first').clone(true);
|
||||
trClone.removeClass('clone d-none');
|
||||
|
||||
const tr = trClone.clone(true);
|
||||
tr.data('url', value.toLowerCase());
|
||||
tr.attr('id', 'tr-scf' + newValue);
|
||||
tr.children('td:first').text(value);
|
||||
tr.children('td:nth-child(2)').children('select').val(IGNORE_NOTHING);
|
||||
$('#tab-site-preferences table tbody:first').append(tr);
|
||||
$('#tab-site-preferences table tbody:first tr.empty:first').hide();
|
||||
|
||||
options.settings['sitePreferences'].push({ url: value.toLowerCase(), ignore: IGNORE_NOTHING, usernameOnly: false });
|
||||
options.saveSettings();
|
||||
manualUrl.value = '';
|
||||
// Fills the last / char if needed. This ensures the compatibility with Match Patterns
|
||||
if (slashNeededForUrl(value)) {
|
||||
value += '/';
|
||||
}
|
||||
|
||||
// Check if the URL is already in the list
|
||||
if (options.settings['sitePreferences'].some(s => s.url === value)) {
|
||||
options.createWarning(manualUrl, errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.settings['sitePreferences'] === undefined) {
|
||||
options.settings['sitePreferences'] = [];
|
||||
}
|
||||
|
||||
const newValue = options.settings['sitePreferences'].length + 1;
|
||||
const trClone = $('#tab-site-preferences table tr.clone:first').clone(true);
|
||||
trClone.removeClass('clone d-none');
|
||||
|
||||
const tr = trClone.clone(true);
|
||||
tr.data('url', value.toLowerCase());
|
||||
tr.attr('id', 'tr-scf' + newValue);
|
||||
tr.children('td:first').text(value);
|
||||
tr.children('td:nth-child(2)').children('select').val(IGNORE_NOTHING);
|
||||
$('#tab-site-preferences table tbody:first').append(tr);
|
||||
$('#tab-site-preferences table tbody:first tr.empty:first').hide();
|
||||
|
||||
options.settings['sitePreferences'].push({ url: value.toLowerCase(), ignore: IGNORE_NOTHING, usernameOnly: false });
|
||||
options.saveSettings();
|
||||
manualUrl.value = '';
|
||||
});
|
||||
|
||||
$('#dialogDeleteSite .modal-footer:first button.yes:first').click(function(e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue