mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
handle login cancelation
This commit is contained in:
parent
dbcbcc1ad2
commit
452d90b352
1 changed files with 15 additions and 3 deletions
|
|
@ -976,8 +976,12 @@ async def process_contact_chat_line(mc, contact, line):
|
||||||
password=f.readline().strip()
|
password=f.readline().strip()
|
||||||
|
|
||||||
if password == "":
|
if password == "":
|
||||||
sess = PromptSession("Password: ", is_password=True)
|
try:
|
||||||
password = await sess.prompt_async()
|
sess = PromptSession("Password: ", is_password=True)
|
||||||
|
password = await sess.prompt_async()
|
||||||
|
except EOFError:
|
||||||
|
logger.info("Canceled")
|
||||||
|
return True
|
||||||
|
|
||||||
if password_file != "":
|
if password_file != "":
|
||||||
with open(password_file, "w", encoding="utf-8") as f :
|
with open(password_file, "w", encoding="utf-8") as f :
|
||||||
|
|
@ -1990,7 +1994,12 @@ async def next_cmd(mc, cmds, json_output=False):
|
||||||
else:
|
else:
|
||||||
print(f"Unknown contact {cmds[1]}")
|
print(f"Unknown contact {cmds[1]}")
|
||||||
else:
|
else:
|
||||||
res = await mc.commands.send_login(contact, cmds[2])
|
password = cmds[2]
|
||||||
|
if password == "$":
|
||||||
|
sess = PromptSession("Password: ", is_password=True)
|
||||||
|
password = await sess.prompt_async()
|
||||||
|
|
||||||
|
res = await mc.commands.send_login(contact, password)
|
||||||
logger.debug(res)
|
logger.debug(res)
|
||||||
if res.type == EventType.ERROR:
|
if res.type == EventType.ERROR:
|
||||||
if json_output :
|
if json_output :
|
||||||
|
|
@ -2572,6 +2581,9 @@ async def next_cmd(mc, cmds, json_output=False):
|
||||||
except IndexError:
|
except IndexError:
|
||||||
logger.error("Error in parameters, returning")
|
logger.error("Error in parameters, returning")
|
||||||
return None
|
return None
|
||||||
|
except EOFError:
|
||||||
|
logger.error("Cancelled")
|
||||||
|
return None
|
||||||
|
|
||||||
async def process_cmds (mc, args, json_output=False) :
|
async def process_cmds (mc, args, json_output=False) :
|
||||||
cmds = args
|
cmds = args
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue