word entry
This commit is contained in:
parent
d316fa0124
commit
c493677595
@ -880,6 +880,7 @@ async def start_login_sequence():
|
||||
if sp_unlock and sssp_spending_policy('words'):
|
||||
# challenge them also for first and last seed word! (will reboot on fail)
|
||||
await sssp_word_challenge()
|
||||
dis.fullscreen("Startup...")
|
||||
|
||||
if sp_unlock:
|
||||
# Disable spending policy going forward; user has to re-enable.
|
||||
|
||||
@ -1129,7 +1129,6 @@ async def sssp_word_challenge(*a):
|
||||
want_words = words[:1] + words[-1:]
|
||||
assert len(want_words) == 2
|
||||
|
||||
got_words = []
|
||||
for retry in range(2):
|
||||
if version.has_qwerty:
|
||||
# see special rendering code for this case in ux_q1.py:ux_draw_words(num_words=2)
|
||||
@ -1137,18 +1136,17 @@ async def sssp_word_challenge(*a):
|
||||
got_words = await seed_word_entry('First and Last Seed Words', 2, has_checksum=False)
|
||||
else:
|
||||
from seed import WordNestMenu
|
||||
got_words = await WordNestMenu.login_sequence_word_check()
|
||||
got_words = await WordNestMenu.get_n_words(2)
|
||||
|
||||
if got_words == want_words:
|
||||
# success - done
|
||||
return
|
||||
|
||||
await ux_show_story("Sorry, those words are incorrect.")
|
||||
got_words = []
|
||||
|
||||
# they failed; log them out ... they can just try login again
|
||||
from actions import login_now
|
||||
login_now()
|
||||
await login_now()
|
||||
|
||||
# NOT-REACHED
|
||||
|
||||
|
||||
@ -171,26 +171,30 @@ class WordNestMenu(MenuSystem):
|
||||
super(WordNestMenu, self).__init__(items)
|
||||
|
||||
@classmethod
|
||||
async def menu_done_cbf(cls, a, b, c):
|
||||
if c.label[-1] == '-':
|
||||
lc = c.label[0:-1]
|
||||
else:
|
||||
lc = ""
|
||||
cls.words.append(c.label)
|
||||
if len(cls.words) >= 2:
|
||||
from glob import numpad
|
||||
numpad.abort_ux()
|
||||
return
|
||||
async def get_n_words(cls, nwords):
|
||||
# Just block until N words are provided. May only work before menus start?
|
||||
from glob import numpad
|
||||
|
||||
m = cls(prefix=lc, menu_cbf=cls.menu_done_cbf)
|
||||
the_ux.push(m)
|
||||
await m.interact()
|
||||
async def menu_done_cbf(menu, b, c):
|
||||
# duplicates some of the logic of next_menu
|
||||
if c.label[-1] == '-':
|
||||
lc = c.label[0:-1]
|
||||
else:
|
||||
lc = ""
|
||||
cls.words.append(c.label)
|
||||
if len(cls.words) >= nwords:
|
||||
numpad.abort_ux()
|
||||
return
|
||||
|
||||
m = cls(prefix=lc, menu_cbf=menu_done_cbf)
|
||||
the_ux.push(m)
|
||||
await m.interact()
|
||||
|
||||
m = cls(num_words=nwords, menu_cbf=menu_done_cbf, has_checksum=False)
|
||||
|
||||
@classmethod
|
||||
async def login_sequence_word_check(cls):
|
||||
m = cls(num_words=2, menu_cbf=WordNestMenu.menu_done_cbf)
|
||||
the_ux.push(m)
|
||||
await the_ux.interact()
|
||||
|
||||
return cls.words
|
||||
|
||||
@staticmethod
|
||||
|
||||
Loading…
Reference in New Issue
Block a user