feat(android): a settings screen, and the unlock code can finally be removed
Three things of different natures lived in collapsible panels on the home screen - repository credentials, the unlock code, the log - on the one screen where one mostly wants to open one's vault. They move to a settings sheet, reachable from the list too. A sheet, not a fourth view of the rail: each view costs its transform rules and a place in back-key navigation, and settings is not somewhere one moves about - it is a parenthesis one opens and closes. The unlock code can now be REMOVED. It could not before: clearing the field meant "nothing typed", not "drop the protection", so one could set a code and never get out. It requires an open vault, and that is the proof being asked for - the cache only let itself be read under the right code. Without that, anyone holding the unlocked phone could lift the protection without knowing it. The refusal that guards every other path stays: it is what stopped a sync from silently undoing a code. Removing is the one deliberate way out, and it says so at the call site. The old fields stay in the document as the source Delphi knows; the sheet is only a view of them. Emptying them would lose the configuration at the first sync.
This commit is contained in:
+65
@@ -303,6 +303,9 @@ type
|
||||
procedure PublishPending;
|
||||
/// Demande au depot s'il a bouge, sans rien adopter.
|
||||
procedure ProbeRemote;
|
||||
/// Retire le code de deverrouillage : le cache se rescelle sous la seule
|
||||
/// cle de l'appareil. Exige un coffre ouvert.
|
||||
procedure ClearUnlockCode;
|
||||
procedure ReopenEntryByUuid(const AUuid: string);
|
||||
procedure OnClipTimer(Sender: TObject);
|
||||
procedure OnDeadline(Sender: TObject);
|
||||
@@ -406,6 +409,7 @@ begin
|
||||
// cache par la version du depot, et ce qui attend ici serait perdu.
|
||||
FPending := HasPendingFlag;
|
||||
PushConfig;
|
||||
WebCall('PM.setVersion("Coffre 1.0.0")');
|
||||
ShowUnlock;
|
||||
{$IFNDEF DEBUG}
|
||||
// Le journal quitte l'ecran d'accueil, sans quitter l'application : un appui
|
||||
@@ -530,6 +534,16 @@ begin
|
||||
end;
|
||||
// C'est la PAGE qui sait ce qu'elle affiche - Delphi ne le devine pas. Elle
|
||||
// le declare a chaque changement de vue (cmd://state).
|
||||
// LES REGLAGES SE REFERMENT D'ABORD. Ils sont une parenthese posee par-dessus
|
||||
// le reste : la touche retour la ferme, elle ne saute pas ce qu'il y a
|
||||
// derriere.
|
||||
if FWebView = 'settings' then
|
||||
begin
|
||||
WebCall('PM.closeSettings()');
|
||||
Key := 0;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// UNE SELECTION EN COURS S'ANNULE D'ABORD. Verrouiller le coffre parce qu'on
|
||||
// a voulu annuler un choix serait le contraire de ce que le geste veut dire.
|
||||
if FWebView = 'select' then
|
||||
@@ -1605,6 +1619,9 @@ begin
|
||||
TNetEncoding.URL.Decode(Param('k')),
|
||||
TNetEncoding.URL.Decode(Param('d')))
|
||||
|
||||
else if LAction = 'pinclear' then
|
||||
ClearUnlockCode
|
||||
|
||||
else if LAction = 'delentry' then
|
||||
DeleteEntriesAt(TNetEncoding.URL.Decode(Param('i')))
|
||||
|
||||
@@ -2518,6 +2535,54 @@ end;
|
||||
/// pas repondre sans lui - mais il est jete sans etre dechiffre : pas de
|
||||
/// derivation, pas d'ecriture, seulement une comparaison de chaines. Le prix
|
||||
/// est en reseau, pas en temps ni en batterie.
|
||||
/// RETIRER LE CODE DE DEVERROUILLAGE.
|
||||
///
|
||||
/// Il manquait : vider le champ voulait dire "rien tape", pas "enlever la
|
||||
/// protection", et rien d'autre ne le proposait. On pouvait donc en poser un
|
||||
/// et jamais en sortir.
|
||||
///
|
||||
/// EXIGE UN COFFRE OUVERT, et c'est la preuve qu'on cherche : le cache ne
|
||||
/// s'est laisse lire que sous le bon code. Sans cette condition, n'importe qui
|
||||
/// tenant l'appareil deverrouille pourrait retirer la protection sans la
|
||||
/// connaitre.
|
||||
procedure TForm8.ClearUnlockCode;
|
||||
begin
|
||||
if FBusy then Exit;
|
||||
if not VaultNeedsPin then
|
||||
begin
|
||||
WebCall('PM.toast("No unlock code to remove")');
|
||||
Exit;
|
||||
end;
|
||||
if (FPlain = '') or (FSyncPwd = '') then
|
||||
begin
|
||||
WebCall('PM.toast("Open the vault first")');
|
||||
Exit;
|
||||
end;
|
||||
try
|
||||
SaveVault(FPlain, FETag, FSyncPwd, BiometricAvailable, False, '',
|
||||
FKey, FKeySalt, FKeyIters, True);
|
||||
if VaultNeedsPin then
|
||||
begin
|
||||
Log('Unlock code not removed: ' + LastStoreError);
|
||||
WebCall('PM.toast("Could not remove the unlock code")');
|
||||
Exit;
|
||||
end;
|
||||
FPinSealed := '';
|
||||
FPin := '';
|
||||
FPinNew := '';
|
||||
Log('Unlock code removed');
|
||||
WebCall('PM.toast("Unlock code removed")');
|
||||
WebCall('PM.pinChanged()');
|
||||
ShowUnlock;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
Log('Unlock code not removed: ' + E.ClassName + ' - ' + E.Message);
|
||||
WebCall('PM.toast("Could not remove the unlock code")');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm8.ProbeRemote;
|
||||
begin
|
||||
if FBusy or (FUrl = '') or (FToken = '') then Exit;
|
||||
|
||||
Reference in New Issue
Block a user