Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow autofill and autosubmit configuration on a per site basis #2358

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add setting options to enable auto submit fill and totp
  • Loading branch information
A-K-O-R-A committed Oct 6, 2024
commit 9a07a9d7c5accc36406366958f90d49fc065bcb3
6 changes: 6 additions & 0 deletions keepassxc-browser/options/options.html
Original file line number Diff line number Diff line change
@@ -741,6 +741,9 @@ <h2 class="pb-3 mt-0" data-i18n="optionsSitePreferencesTab"></h2>
<th scope="col"><span data-i18n="optionsColumnUsernameOnly"></span></th>
<th scope="col"><span data-i18n="optionsColumnImprovedInputFieldDetection"></span></th>
<th scope="col"><span data-i18n="optionsColumnAllowIframes"></span></th>
<th scope="col"><span data-i18n="optionsCheckboxAutoSubmit"></span></th>
<th scope="col"><span data-i18n="optionsCheckboxAutoFillSingleEntry"></span></th>
<th scope="col"><span data-i18n="optionsCheckboxAutoFillSingleTotp"></span></th>
<th scope="col"><span data-i18n="optionsColumnDelete"></span></th>
</tr>
</thead>
@@ -761,6 +764,9 @@ <h2 class="pb-3 mt-0" data-i18n="optionsSitePreferencesTab"></h2>
<td><input class="form-check-input" type="checkbox" name="usernameOnly" value="false" data-i18n="[title]optionsColumnUsernameOnly"></td>
<td><input class="form-check-input" type="checkbox" name="improvedFieldDetection" value="false" data-i18n="[title]optionsColumnImprovedInputFieldDetection"></td>
<td><input class="form-check-input" type="checkbox" name="allowIframes" value="false" data-i18n="[title]optionsColumnAllowIframes"></td>
<td><input class="form-check-input" type="checkbox" name="autoSubmit" value="false" data-i18n="[title]optionsColumnAutoSubmit"></td>
<td><input class="form-check-input" type="checkbox" name="autoFillCredentials" value="false" data-i18n="[title]optionsColumnAutoFillCredentials"></td>
<td><input class="form-check-input" type="checkbox" name="autoFillTOTP" value="false" data-i18n="[title]optionsColumnAutoFillTOTP"></td>
<td class="text-nowrap">
<button class="btn btn-sm delete btn-danger btn" data-i18n="[title]removeSitePreferencesButtonTitle">
<i class="fa fa-remove" aria-hidden="true"></i>
21 changes: 18 additions & 3 deletions keepassxc-browser/options/options.js
Original file line number Diff line number Diff line change
@@ -545,6 +545,12 @@ options.initSitePreferences = function() {
site.improvedFieldDetection = this.checked;
} else if (this.name === 'allowIframes') {
site.allowIframes = this.checked;
} else if (this.name === 'autoSubmit') {
site.autoSubmit = this.checked;
} else if (this.name === 'autoFillCredentials') {
site.autoFillCredentials = this.checked;
} else if (this.name === 'autoFillTOTP') {
site.autoFillTOTP = this.checked;
}
}
}
@@ -565,7 +571,7 @@ options.initSitePreferences = function() {
options.saveSettings();
};

const addNewRow = function(rowClone, newIndex, url, ignore, usernameOnly, improvedFieldDetection, allowIframes) {
const addNewRow = function(rowClone, newIndex, url, ignore, usernameOnly, improvedFieldDetection, allowIframes, autoSubmit, autoFillCredentials, autoFillTOTP) {
const row = rowClone.cloneNode(true);
row.setAttribute('url', url);
row.setAttribute('id', 'tr-scf' + newIndex);
@@ -578,7 +584,13 @@ options.initSitePreferences = function() {
row.children[3].children['improvedFieldDetection'].addEventListener('change', checkboxClicked);
row.children[4].children['allowIframes'].checked = allowIframes;
row.children[4].children['allowIframes'].addEventListener('change', checkboxClicked);
row.children[5].addEventListener('click', removeButtonClicked);
row.children[5].children['autoSubmit'].checked = autoSubmit;
row.children[5].children['autoSubmit'].addEventListener('change', checkboxClicked);
row.children[6].children['autoFillCredentials'].checked = autoFillCredentials;
row.children[6].children['autoFillCredentials'].addEventListener('change', checkboxClicked);
row.children[7].children['autoFillTOTP'].checked = autoFillTOTP;
row.children[7].children['autoFillTOTP'].addEventListener('change', checkboxClicked);
row.children[8].addEventListener('click', removeButtonClicked);

$('#tab-site-preferences table tbody').append(row);
};
@@ -638,7 +650,7 @@ options.initSitePreferences = function() {
const rowClone = $('#tab-site-preferences table tr.clone').cloneNode(true);
rowClone.classList.remove('clone', 'd-none');

addNewRow(rowClone, newIndex, value, IGNORE_NOTHING, false, false, false);
addNewRow(rowClone, newIndex, value, IGNORE_NOTHING, false, false, false, false, false, false);
$('#tab-site-preferences table tbody tr.empty').hide();

options.settings['sitePreferences'].push({
@@ -665,6 +677,9 @@ options.initSitePreferences = function() {
site.usernameOnly,
site.improvedFieldDetection,
site.allowIframes,
site.autoSubmit,
site.autoFillCredentials,
site.autoFillTOTP,
);
++counter;
}