mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
change filename for password to using pubkey instead of node name
This commit is contained in:
parent
4471753b51
commit
5a2f3a0f06
1 changed files with 14 additions and 0 deletions
|
|
@ -990,7 +990,18 @@ async def process_contact_chat_line(mc, contact, line):
|
|||
password_file = ""
|
||||
password = ""
|
||||
if os.path.isdir(MCCLI_CONFIG_DIR) :
|
||||
# if a password file exists with node name open it and destroy it
|
||||
password_file = MCCLI_CONFIG_DIR + contact['adv_name'] + ".pass"
|
||||
if os.path.exists(password_file) :
|
||||
with open(password_file, "r", encoding="utf-8") as f :
|
||||
password=f.readline().strip()
|
||||
os.remove(password_file)
|
||||
password_file = MCCLI_CONFIG_DIR + contact["public_key"] + ".pass"
|
||||
with open(password_file, "w", encoding="utf-8") as f :
|
||||
f.write(password)
|
||||
|
||||
# this is the new correct password file, using pubkey
|
||||
password_file = MCCLI_CONFIG_DIR + contact["public_key"] + ".pass"
|
||||
if os.path.exists(password_file) :
|
||||
with open(password_file, "r", encoding="utf-8") as f :
|
||||
password=f.readline().strip()
|
||||
|
|
@ -1013,6 +1024,9 @@ async def process_contact_chat_line(mc, contact, line):
|
|||
|
||||
if line.startswith("forget_password") or line.startswith("fp"):
|
||||
password_file = MCCLI_CONFIG_DIR + contact['adv_name'] + ".pass"
|
||||
if os.path.exists(password_file):
|
||||
os.remove(password_file)
|
||||
password_file = MCCLI_CONFIG_DIR + contact['public_key'] + ".pass"
|
||||
if os.path.exists(password_file):
|
||||
os.remove(password_file)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue