diff --git a/account/account.py b/account/account.py index d74c274..021223c 100644 --- a/account/account.py +++ b/account/account.py @@ -65,7 +65,19 @@ def delete(): if passwordhash: if verify_hash == passwordhash: - return "Your account would have been deleted... if this worked. Which it doesn't. Email postmaster@hectabit.org to delete your email." + # return "Your account would have been deleted... if this worked. Which it doesn't. Email postmaster@hectabit.org to delete your email." + cmd = ["maddy", "creds", "delete", key_to_fetch] + result = subprocess.run(" ".join(cmd), shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if result.returncode == 0: + # Command executed successfully + return "Email deleted!" + else: + # Handle errors, log them, and return False + error_message = result.stderr.decode("utf-8") + print(f"Error deleting email account: {error_message}") + return "Error deleting email account!" + else: return "Incorrect email or password" else: