fix(android): saving now answers, and the editor hides what you type
Two defects, both reported from the device. Nothing came back after Save. AdoptVault rebuilds the LIST, not the detail, so the row stayed in edit mode: the input remained on screen and nothing said whether the write had gone through. The detail is now redrawn from the vault in both cases - after a success it carries the new value, after a failure the old one, which reads without needing a sentence. It is found by UUID rather than by index: the vault has just been replaced by the server's, and nothing guarantees the same entry sits at the same rank. The button also stayed inert-looking for the several seconds a save takes, so it now says "Saving..." and disables itself while the work runs. And the typed password showed in clear. My reasoning was that you cannot verify it anywhere else - but that argues for a reveal button, not for leaving it exposed the whole time. It is masked, with Show next to it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -533,10 +533,28 @@ document.getElementById('fields').addEventListener('click', function (ev) {
|
||||
|
||||
var edit = t.getAttribute('data-edit');
|
||||
if (edit !== null) { openEditor(edit); return; }
|
||||
if (t.getAttribute('data-editshow') !== null) {
|
||||
// Masque par defaut, revelable a la demande : on tape un mot de passe
|
||||
// qu'on ne peut relire nulle part ailleurs, mais il n'a pas a rester
|
||||
// expose a l'ecran pendant qu'on cherche le bouton.
|
||||
var iv = document.getElementById('editval');
|
||||
var hid = iv.type === 'password';
|
||||
iv.type = hid ? 'text' : 'password';
|
||||
t.textContent = hid ? 'Hide' : 'Show';
|
||||
return;
|
||||
}
|
||||
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
|
||||
// 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.
|
||||
t.textContent = 'Saving...';
|
||||
t.disabled = true;
|
||||
var cancel = document.querySelector('[data-editcancel]');
|
||||
if (cancel) cancel.disabled = true;
|
||||
input.disabled = true;
|
||||
send('setpwd?v=' + encodeURIComponent(input.value));
|
||||
return;
|
||||
}
|
||||
@@ -554,9 +572,10 @@ function openEditor(k) {
|
||||
if (!row) return;
|
||||
var line = row.parentNode;
|
||||
line.innerHTML =
|
||||
'<input class="field-in" id="editval" type="text" autocomplete="off"'
|
||||
'<input class="field-in" id="editval" type="password" autocomplete="off"'
|
||||
+ ' autocorrect="off" autocapitalize="none" spellcheck="false"'
|
||||
+ ' style="margin:0">'
|
||||
+ '<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