Exemple #1
0
def confirm_remove_pin(session_id):
    from apps.common.confirm import require_confirm
    from trezor.ui.text import Text
    return require_confirm(
        session_id,
        Text('Remove PIN', ui.ICON_RESET, 'Do you really want to', ui.BOLD,
             'remove current PIN?'))
Exemple #2
0
def confirm_set_pin(session_id):
    from apps.common.confirm import require_confirm
    from trezor.ui.text import Text
    return require_confirm(
        session_id,
        Text('Change PIN', ui.ICON_RESET, 'Do you really want to', ui.BOLD,
             'set new PIN?'))
Exemple #3
0
def confirm_change_pin(ctx):
    from apps.common.confirm import require_confirm
    from trezor.ui.text import Text
    return require_confirm(ctx, Text(
        'Change PIN', ui.ICON_RESET,
        'Do you really want to', ui.BOLD,
        'change current PIN?'))
Exemple #4
0
def require_confirm_change_pin(ctx, msg):
    has_pin = config.has_pin()

    if msg.remove and has_pin:  # removing pin
        text = Text("Remove PIN", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("disable PIN protection?")
        return require_confirm(ctx, text)

    if not msg.remove and has_pin:  # changing pin
        text = Text("Change PIN", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("change the current PIN?")
        return require_confirm(ctx, text)

    if not msg.remove and not has_pin:  # setting new pin
        text = Text("Enable PIN", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("enable PIN protection?")
        return require_confirm(ctx, text)
Exemple #5
0
def require_confirm_change_pin(ctx, msg):
    has_pin = config.has_pin()

    if msg.remove and has_pin:  # removing pin
        text = Text('Remove PIN', ui.ICON_CONFIG)
        text.normal('Do you really want to')
        text.bold('remove current PIN?')
        return require_confirm(ctx, text)

    if not msg.remove and has_pin:  # changing pin
        text = Text('Remove PIN', ui.ICON_CONFIG)
        text.normal('Do you really want to')
        text.bold('change current PIN?')
        return require_confirm(ctx, text)

    if not msg.remove and not has_pin:  # setting new pin
        text = Text('Remove PIN', ui.ICON_CONFIG)
        text.normal('Do you really want to')
        text.bold('set new PIN?')
        return require_confirm(ctx, text)
def confirm_change_pin(ctx, msg):
    has_pin = config.has_pin()

    if msg.remove and has_pin:  # removing pin
        return require_confirm(
            ctx,
            Text('Remove PIN', ui.ICON_DEFAULT, 'Do you really want to',
                 ui.BOLD, 'remove current PIN?'))

    if not msg.remove and has_pin:  # changing pin
        return require_confirm(
            ctx,
            Text('Change PIN', ui.ICON_DEFAULT, 'Do you really want to',
                 ui.BOLD, 'change current PIN?'))

    if not msg.remove and not has_pin:  # setting new pin
        return require_confirm(
            ctx,
            Text('Change PIN', ui.ICON_DEFAULT, 'Do you really want to',
                 ui.BOLD, 'set new PIN?'))
Exemple #7
0
def confirm_change_pin(ctx, msg):
    from apps.common.confirm import require_confirm
    from trezor.ui.text import Text

    has_pin = config.has_pin()

    if msg.remove and has_pin:  # removing pin
        return require_confirm(ctx, Text(
            'Remove PIN', ui.ICON_RESET,
            'Do you really want to', ui.BOLD,
            'remove current PIN?'))

    if not msg.remove and has_pin:  # changing pin
        return require_confirm(ctx, Text(
            'Change PIN', ui.ICON_RESET,
            'Do you really want to', ui.BOLD,
            'change current PIN?'))

    if not msg.remove and not has_pin:  # setting new pin
        return require_confirm(ctx, Text(
            'Change PIN', ui.ICON_RESET,
            'Do you really want to', ui.BOLD,
            'set new PIN?'))
Exemple #8
0
def _require_confirm_action(ctx: wire.Context, msg: ChangeWipeCode,
                            has_wipe_code: bool) -> None:
    if msg.remove and has_wipe_code:
        text = Text("Disable wipe code", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("disable wipe code")
        text.bold("protection?")
        return require_confirm(ctx, text)

    if not msg.remove and has_wipe_code:
        text = Text("Change wipe code", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("change the wipe code?")
        return require_confirm(ctx, text)

    if not msg.remove and not has_wipe_code:
        text = Text("Set wipe code", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("set the wipe code?")
        return require_confirm(ctx, text)

    # Removing non-existing wipe code.
    raise wire.ProcessError("Wipe code protection is already disabled")
Exemple #9
0
def require_confirm_change_pin(ctx: wire.Context, msg: ChangePin) -> None:
    has_pin = config.has_pin()

    if msg.remove and has_pin:  # removing pin
        text = Text("Remove PIN", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("disable PIN protection?")
        return require_confirm(ctx, text)

    if not msg.remove and has_pin:  # changing pin
        text = Text("Change PIN", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("change your PIN?")
        return require_confirm(ctx, text)

    if not msg.remove and not has_pin:  # setting new pin
        text = Text("Enable PIN", ui.ICON_CONFIG)
        text.normal("Do you really want to")
        text.bold("enable PIN protection?")
        return require_confirm(ctx, text)

    # removing non-existing PIN
    raise wire.ProcessError("PIN protection already disabled")
def require_confirm_sd_protect(ctx: wire.Context, msg: SdProtect) -> None:
    if msg.operation == SdProtectOperationType.ENABLE:
        text = Text("SD card protection", ui.ICON_CONFIG)
        text.normal("Do you really want to", "secure your device with",
                    "SD card protection?")
    elif msg.operation == SdProtectOperationType.DISABLE:
        text = Text("SD card protection", ui.ICON_CONFIG)
        text.normal("Do you really want to", "remove SD card",
                    "protection from your", "device?")
    elif msg.operation == SdProtectOperationType.REFRESH:
        text = Text("SD card protection", ui.ICON_CONFIG)
        text.normal(
            "Do you really want to",
            "replace the current",
            "SD card secret with a",
            "newly generated one?",
        )
    else:
        raise wire.ProcessError("Unknown operation")

    return require_confirm(ctx, text)