From 661aac744c4fd94293cb9f200e71b2bc06ec6605 Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Mon, 17 Aug 2026 13:48:54 +0100 Subject: [PATCH] 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 --- mainApk.pas | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/mainApk.pas b/mainApk.pas index b31899c..17c6368 100644 --- a/mainApk.pas +++ b/mainApk.pas @@ -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