change filename for password to using pubkey instead of node name

This commit is contained in:
Florent 2025-11-02 14:26:07 +01:00
parent 4471753b51
commit 5a2f3a0f06

View file

@ -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: