diff --git a/core/src/apps/webauthn/add_resident_credential.py b/core/src/apps/webauthn/add_resident_credential.py index 08135cbe4d..822f26f097 100644 --- a/core/src/apps/webauthn/add_resident_credential.py +++ b/core/src/apps/webauthn/add_resident_credential.py @@ -1,8 +1,8 @@ import storage.device -from trezor import ui, wire +from trezor import wire from trezor.messages.Success import Success from trezor.messages.WebAuthnAddResidentCredential import WebAuthnAddResidentCredential -from trezor.ui.components.tt.text import Text +from trezor.ui.layouts import require, show_error from apps.common.confirm import require_confirm @@ -41,14 +41,16 @@ async def add_resident_credential( try: cred = Fido2Credential.from_cred_id(bytes(msg.credential_id), None) except Exception: - text = Text("Import credential", ui.ICON_WRONG, ui.RED) - text.normal( - "The credential you are", - "trying to import does", - "not belong to this", - "authenticator.", + await require( + show_error( + ctx, + "warning_credential", + header="Import credential", + button="Close", + content="The credential you are trying to import does\nnot belong to this authenticator.", + red=True, + ) ) - await require_confirm(ctx, text, confirm=None, cancel="Close") raise wire.ActionCancelled content = ConfirmContent(ConfirmAddCredential(cred)) diff --git a/core/src/apps/webauthn/list_resident_credentials.py b/core/src/apps/webauthn/list_resident_credentials.py index 4b1576232f..8d7fa405ce 100644 --- a/core/src/apps/webauthn/list_resident_credentials.py +++ b/core/src/apps/webauthn/list_resident_credentials.py @@ -4,9 +4,7 @@ from trezor.messages.WebAuthnCredentials import WebAuthnCredentials from trezor.messages.WebAuthnListResidentCredentials import ( WebAuthnListResidentCredentials, ) -from trezor.ui.components.tt.text import Text - -from apps.common.confirm import require_confirm +from trezor.ui.layouts import confirm_action, require from . import resident_credentials @@ -14,14 +12,14 @@ from . import resident_credentials async def list_resident_credentials( ctx: wire.Context, msg: WebAuthnListResidentCredentials ) -> WebAuthnCredentials: - text = Text("List credentials") - text.normal( - "Do you want to export", - "information about the", - "resident credentials", - "stored on this device?", + await require( + confirm_action( + ctx, + "credentials_list", + title="List credentials", + description="Do you want to export information about the resident credentials stored on this device?", + ) ) - await require_confirm(ctx, text) creds = [ WebAuthnCredential( index=cred.index, diff --git a/core/src/trezor/ui/layouts/tt.py b/core/src/trezor/ui/layouts/tt.py index d013b933f9..d06b3990b1 100644 --- a/core/src/trezor/ui/layouts/tt.py +++ b/core/src/trezor/ui/layouts/tt.py @@ -358,6 +358,7 @@ def show_error( header: str = "Error", subheader: Optional[str] = None, button: str = "Close", + red: bool = False, ) -> Awaitable[bool]: return _show_modal( ctx, @@ -369,7 +370,7 @@ def show_error( button_confirm=None, button_cancel=button, icon=ui.ICON_WRONG, - icon_color=ui.ORANGE_ICON, + icon_color=ui.RED if red else ui.ORANGE_ICON, )