1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

fix(python/trezorctl): do not prompt twice when enabling force-on-device

fixes #2833
This commit is contained in:
matejcik 2023-04-24 12:26:52 +02:00
parent 0c5db05357
commit cc2314d89d
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1 @@
When enabling passphrase force-on-device, do not also prompt to enable passphrase if it is already enabled.

View File

@ -319,8 +319,14 @@ passphrase = cast(AliasedGroup, passphrase_main)
@with_client @with_client
def passphrase_on(client: "TrezorClient", force_on_device: Optional[bool]) -> str: def passphrase_on(client: "TrezorClient", force_on_device: Optional[bool]) -> str:
"""Enable passphrase.""" """Enable passphrase."""
if client.features.passphrase_protection is not True:
use_passphrase = True
else:
use_passphrase = None
return device.apply_settings( return device.apply_settings(
client, use_passphrase=True, passphrase_always_on_device=force_on_device client,
use_passphrase=use_passphrase,
passphrase_always_on_device=force_on_device,
) )