fix(android): keep the endpoint and token once the transport works

They were saved only after a successful decryption, in the name of storing
proven settings rather than typed ones. The consequence showed up the moment
the password did not match: the URL and the token were lost on the next
launch, and both had to be typed again - an API URL and forty characters of
token, on a phone, on every attempt.

A 200 with a container in hand already proves the address and the token. The
password is a separate matter, and this call never stored it anyway. So the
settings are kept there, before decryption, and the vault plus its fingerprint
still wait for a decryption that actually worked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-08-17 13:48:54 +01:00
parent 74b20266b3
commit 661aac744c
+18 -3
View File
@@ -856,6 +856,24 @@ begin
end;
Log(' received ' + Length(LRes.Container).ToString + ' bytes');
// LES COORDONNEES SONT RETENUES ICI, avant le dechiffrement. Un 200
// avec un conteneur en main prouve l'adresse ET le jeton ; le mot de
// passe est une autre affaire, et il n'est de toute facon pas enregistre
// par cet appel.
//
// Elles ne l'etaient qu'apres un dechiffrement reussi, au nom des
// « reglages eprouves ». Consequence : un mot de passe qui ne convient
// pas faisait perdre l'URL et le jeton au lancement suivant, et il
// fallait les retaper - une URL d'API et quarante caracteres de jeton,
// sur un telephone, a chaque essai.
try
SaveDeviceSettings(AUrl, ATok);
except
on E: Exception do
Log(' settings not saved: ' + E.ClassName + ' - ' + E.Message);
end;
if not ASilent then
TThread.Queue(nil, procedure begin Status('Decrypting...'); end);
@@ -873,9 +891,6 @@ begin
// Le mot de passe part avec le coffre : c'est lui qui permettra au
// prochain lancement de rafraichir sans rien demander.
SaveVault(LPlain, FETag, APwd, LCanAuth);
// Ce qui vient de fonctionner merite d'etre retenu : on n'enregistre
// pas des reglages saisis, on enregistre des reglages EPROUVES.
SaveDeviceSettings(AUrl, ATok);
if VaultNeedsAuth then
Log(' cache written - protected by biometrics/PIN')
else if LCanAuth then