示例#1
0
    async def setup_pin(self, get_word=None):
        """
        PIN setup screen - first choose, then confirm
        If PIN codes are the same -> return the PIN
        If not -> try again
        """
        scr = PinScreen(
            title="Choose your PIN code",
            note="Remember these words,"
            "they will stay the same on this device.",
            get_word=self.get_auth_word,
            subtitle=self.pin_subtitle,
        )
        pin1 = await self.show(scr)

        scr = PinScreen(
            title="Confirm your PIN code",
            note="Remember these words,"
            "they will stay the same on this device.",
            get_word=self.get_auth_word,
            subtitle=self.pin_subtitle,
        )
        pin2 = await self.show(scr)

        # check if PIN is the same
        if pin1 == pin2:
            return pin1
        # if not - show an error
        await self.show(Alert("Error!", "PIN codes are different!"))
        return await self.setup_pin(get_word)
示例#2
0
 async def get_pin(self, title="Enter your PIN code"):
     """
     Async version of the PIN screen.
     Waits for an event that is set in the callback.
     """
     scr = PinScreen(title=title,
                     note="Do you recognize these words?",
                     get_word=self.get_auth_word)
     return await self.show(scr)