feat(android): every field of an entry can be changed, not just the password
PatchEntryField already took a field name; what was missing was carrying it from the row. It travels in the detail row itself rather than being guessed from the label - a caption is prose, and the day it changes the page would send a field name that does not exist, or quietly stop offering the edit. Delphi does not take it on trust either: four names accepted, the rest refused. The snapshot also carries tombstones, attachments and timestamps that PatchEntryField would overwrite without understanding them. An empty row now shows IF it can be filled - a missing username you cannot add is a dead end. Emptying is allowed, except on a password, where it would almost always be a slip; the refusal says so rather than doing nothing. Show only appears on a masked field: on a site in clear it has nothing to reveal, and would in fact hide it. A note keeps only Name and Content - a site and a username mean nothing there.
This commit is contained in:
@@ -630,7 +630,14 @@ document.getElementById('fields').addEventListener('click', function (ev) {
|
||||
if (t.getAttribute('data-editcancel') !== null) { renderDetail(lastDetail); return; }
|
||||
if (t.getAttribute('data-editsave') !== null) {
|
||||
var input = document.getElementById('editval');
|
||||
if (!input || !input.value) return; // vide : on n'ecrase pas par megarde
|
||||
if (!input) return;
|
||||
// VIDER EST LEGITIME sur un site ou un identifiant - pas sur un mot de
|
||||
// passe, ou ce serait presque toujours une fausse manoeuvre. Le refus se
|
||||
// dit, sinon le bouton semble ne pas prendre l'appui.
|
||||
if (!input.value && editField === 'password') {
|
||||
toast('An empty password is not saved');
|
||||
return;
|
||||
}
|
||||
// DIRE QUE CA TRAVAILLE. L'enregistrement tire, dechiffre, rechiffre et
|
||||
// publie : plusieurs secondes pendant lesquelles rien ne bougeait, et le
|
||||
// bouton semblait n'avoir pas pris l'appui.
|
||||
@@ -639,7 +646,8 @@ document.getElementById('fields').addEventListener('click', function (ev) {
|
||||
var cancel = document.querySelector('[data-editcancel]');
|
||||
if (cancel) cancel.disabled = true;
|
||||
input.disabled = true;
|
||||
send('setpwd?v=' + encodeURIComponent(input.value));
|
||||
send('setfield?f=' + encodeURIComponent(editField)
|
||||
+ '&v=' + encodeURIComponent(input.value));
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -651,15 +659,24 @@ document.getElementById('fields').addEventListener('click', function (ev) {
|
||||
// La valeur s'affiche EN CLAIR pendant la saisie. On tape un mot de passe
|
||||
// qu'on ne peut pas relire ailleurs ; le masquer ferait valider a l'aveugle
|
||||
// une frappe qu'aucune confirmation ne rattrape.
|
||||
var editField = '';
|
||||
|
||||
function openEditor(k) {
|
||||
var row = document.querySelector('[data-v="' + k + '"]');
|
||||
if (!row) return;
|
||||
// 'e' porte le nom du champ dans l'instantane, pas un booleen : c'est Delphi
|
||||
// qui decide de ce qui se modifie, la page n'a pas a le deduire d'un libelle.
|
||||
editField = detailRows[k].e || '';
|
||||
if (!editField) return;
|
||||
var line = row.parentNode;
|
||||
line.innerHTML =
|
||||
'<input class="field-in" id="editval" type="password" autocomplete="off"'
|
||||
'<input class="field-in" id="editval" autocomplete="off"'
|
||||
+ ' type="' + (detailRows[k].s ? 'password' : 'text') + '"'
|
||||
+ ' autocorrect="off" autocapitalize="none" spellcheck="false"'
|
||||
+ ' style="margin:0;flex:1;min-width:0;width:auto">'
|
||||
+ '<button class="btn" data-editshow>Show</button>'
|
||||
// Show n'a de sens que sur un champ masque. Sur un site en clair il
|
||||
// n'aurait rien a reveler - et l'inverse : il le CACHERAIT.
|
||||
+ (detailRows[k].s ? '<button class="btn" data-editshow>Show</button>' : '')
|
||||
+ '<button class="btn" data-editcancel>Cancel</button>'
|
||||
+ '<button class="btn main" data-editsave>Save</button>';
|
||||
var input = document.getElementById('editval');
|
||||
|
||||
Reference in New Issue
Block a user