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:
r-zakarya
2026-08-21 16:13:35 +01:00
parent 4785dc116a
commit 732c52a64e
4 changed files with 88 additions and 36 deletions
+22 -8
View File
@@ -236,9 +236,11 @@ type
procedure RefuseChange(const AMessage: string);
procedure CommitChange(const ALabel, AComment, AReopenUuid: string;
const APatch: TFunc<string, string>);
procedure SaveEntryPassword(const ANewValue: string);
/// Change UN champ de l'entree ouverte. Le nom du champ vient de la page,
/// et n'est donc pas cru sur parole.
procedure SaveEntryField(const AField, ANewValue: string);
/// Ajoute une entree au coffre. Le mot de passe voyage par le pont,
/// comme 'setpwd' - meme regle, meme journalisation muette.
/// comme 'setfield' - meme regle, meme journalisation muette.
procedure CreateEntry(const ATitle, ASite, AUser, APwd, AKind: string);
procedure ReopenEntryByUuid(const AUuid: string);
procedure OnClipTimer(Sender: TObject);
@@ -870,7 +872,7 @@ begin
end).Start;
end;
procedure TForm8.SaveEntryPassword(const ANewValue: string);
procedure TForm8.SaveEntryField(const AField, ANewValue: string);
var
LUuid, LTitle: string;
begin
@@ -879,12 +881,23 @@ begin
RefuseChange('This entry has no uuid - cannot be updated');
Exit;
end;
// LA PAGE NE CHOISIT PAS QUOI ECRIRE. Le nom vient d'elle, mais il traverse
// le pont, et ce qui traverse un pont se traite comme une entree exterieure.
// Ces quatre-la seulement : le reste de l'instantane porte des tombstones,
// des pieces jointes et des horodatages, que PatchEntryField ecraserait sans
// rien y comprendre.
if (AField <> 'title') and (AField <> 'site')
and (AField <> 'username') and (AField <> 'password') then
begin
RefuseChange('That field cannot be changed from here');
Exit;
end;
LUuid := FCurrent.Uuid;
LTitle := FCurrent.Display;
CommitChange('Saved: ' + LTitle, 'password change from phone', LUuid,
CommitChange('Saved: ' + LTitle, AField + ' change from phone', LUuid,
function (APlain: string): string
begin
Result := PatchEntryField(APlain, LUuid, 'password', ANewValue);
Result := PatchEntryField(APlain, LUuid, AField, ANewValue);
end);
end;
@@ -1027,7 +1040,7 @@ begin
else if LAction = 'sync' then
DoSync(nil)
// AVEC 'setpwd', LES SEULES COMMANDES QUI TRANSPORTENT UN SECRET. Meme
// AVEC 'setfield', LES SEULES COMMANDES QUI TRANSPORTENT UN SECRET. Meme
// regle qu'elle : la valeur ne quitte pas le processus, l'iframe qui la
// porte est detruite, et seule l'action est journalisee - jamais le mot de
// passe, ni sa longueur.
@@ -1048,8 +1061,9 @@ begin
TNetEncoding.URL.Decode(Param('p')),
TNetEncoding.URL.Decode(Param('k')))
else if LAction = 'setpwd' then
SaveEntryPassword(TNetEncoding.URL.Decode(Param('v')))
else if LAction = 'setfield' then
SaveEntryField(TNetEncoding.URL.Decode(Param('f')),
TNetEncoding.URL.Decode(Param('v')))
else if LAction = 'copy' then
begin