feat(apk): choisir d'ouvrir avec le verrouillage d'ecran, un code ou le mot de passe du coffre
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+44
-3
@@ -337,6 +337,7 @@ type
|
||||
/// le code courant deja connu - c'est ce qui empeche un tiers d'en poser un
|
||||
/// que le proprietaire ne connaitrait pas.
|
||||
procedure SetUnlockCode(const ANew: string);
|
||||
procedure PushUnlockMode;
|
||||
/// Va chercher l'icone du site de l'entree ouverte, ou l'efface.
|
||||
procedure SetEntryIcon(AFetch: Boolean);
|
||||
/// Le depot a bouge, ou ne l'a plus : LE DRAPEAU ET SON TEMOIN ENSEMBLE.
|
||||
@@ -534,6 +535,7 @@ begin
|
||||
WebCall('PM.setAuthMode("login")')
|
||||
else
|
||||
WebCall('PM.setAuthMode("register")');
|
||||
PushUnlockMode;
|
||||
|
||||
LCanOpen := HasVault and not FVaultUnreadable;
|
||||
if LCanOpen then
|
||||
@@ -1701,7 +1703,10 @@ begin
|
||||
Exit // Touch a deja eu lieu plus haut
|
||||
|
||||
else if LAction = 'state' then
|
||||
FWebView := Param('view')
|
||||
begin
|
||||
FWebView := Param('view');
|
||||
if FWebView = 'settings' then PushUnlockMode;
|
||||
end
|
||||
|
||||
else if LAction = 'open' then
|
||||
OpenEntry(StrToIntDef(Param('i'), -1))
|
||||
@@ -1789,7 +1794,16 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
else if LAction = 'pinset' then
|
||||
SetUnlockCode(TNetEncoding.URL.Decode(Param('c')))
|
||||
begin
|
||||
// MODE MOT DE PASSE = le code EST le mot de passe du coffre. On le
|
||||
// verifie : sinon une faute de frappe scellerait sous un "mot de passe"
|
||||
// que l'utilisateur ne retapera jamais a l'identique.
|
||||
if (Param('pw') = '1') and
|
||||
((FPlain = '') or (TNetEncoding.URL.Decode(Param('c')) <> CachePwd)) then
|
||||
WebCall('PM.toast("Wrong vault password")')
|
||||
else
|
||||
SetUnlockCode(TNetEncoding.URL.Decode(Param('c')));
|
||||
end
|
||||
|
||||
else if LAction = 'pinclear' then
|
||||
ClearUnlockCode(TNetEncoding.URL.Decode(Param('c')))
|
||||
@@ -3070,6 +3084,7 @@ begin
|
||||
Log('Unlock code set');
|
||||
WebCall('PM.toast("Unlock code set")');
|
||||
WebCall('PM.pinChanged()');
|
||||
PushUnlockMode;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
@@ -3079,6 +3094,28 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
/// Dit a la page comment le cache est scelle. 'password' = scelle sous un code
|
||||
/// egal au mot de passe du coffre - connu seulement une fois ouvert (FPinSealed).
|
||||
procedure TForm8.PushUnlockMode;
|
||||
var
|
||||
LMode: string;
|
||||
begin
|
||||
if VaultNeedsPin then
|
||||
begin
|
||||
if (FPinSealed <> '') and (FPinSealed = CachePwd) then
|
||||
LMode := 'password'
|
||||
else
|
||||
LMode := 'code';
|
||||
end
|
||||
else if VaultNeedsAuth then
|
||||
LMode := 'device'
|
||||
else
|
||||
LMode := 'none';
|
||||
WebCall(Format('PM.setUnlockMode("%s", %s, %s)',
|
||||
[LMode, LowerCase(BoolToStr(BiometricAvailable, True)),
|
||||
LowerCase(BoolToStr(HasLocalContainer, True))]));
|
||||
end;
|
||||
|
||||
function TForm8.CachePwd: string;
|
||||
begin
|
||||
if HasLocalContainer then Result := FVaultPwd else Result := FSyncPwd;
|
||||
@@ -3117,7 +3154,10 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
try
|
||||
SaveVault(FPlain, FETag, CachePwd, BiometricAvailable, False, '',
|
||||
// Cle NEUVE : le verrouillage d'ecran a pu changer pendant que le code
|
||||
// protegeait, et une ancienne paire invalidee scellerait un fichier
|
||||
// impossible a rouvrir.
|
||||
SaveVault(FPlain, FETag, CachePwd, BiometricAvailable, True, '',
|
||||
FKey, FKeySalt, FKeyIters, True);
|
||||
if VaultNeedsPin then
|
||||
begin
|
||||
@@ -3130,6 +3170,7 @@ begin
|
||||
Log('Unlock code removed');
|
||||
WebCall('PM.toast("Unlock code removed")');
|
||||
WebCall('PM.pinChanged()');
|
||||
PushUnlockMode;
|
||||
ShowUnlock;
|
||||
except
|
||||
on E: Exception do
|
||||
|
||||
Reference in New Issue
Block a user