diff --git a/account/account.py b/account/account.py index a65554d..9160083 100644 --- a/account/account.py +++ b/account/account.py @@ -66,12 +66,15 @@ def delete(): if passwordhash: if verify_hash == passwordhash: - cmd = ["maddy", "creds", "remove", key_to_fetch] + cmd = ["echo", "y", "|", "maddy", "creds", "remove", 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!" + response = make_response("Email deleted!") + response.set_cookie('passwordhash', '', expires=0) + response.set_cookie('email', '', expires=0) + return response else: # Handle errors, log them, and return False error_message = result.stderr.decode("utf-8") @@ -93,8 +96,10 @@ def dashboard(): @app.route('/deleteacct') def deleteacct(): + email = request.cookies.get('email') + passwordhash = request.cookies.get('passwordhash') if 'passwordhash' in request.cookies and request.cookies.get('passwordhash'): - return render_template('confirm.html', user_email=request.cookies.get('email'), password_hash=request.cookies.get('passwordhash')) + return render_template('confirm.html', user_email=email, password_hash=passwordhash) else: return redirect(url_for('index'))