Updated login

This commit is contained in:
Tracker-Friendly 2023-11-20 01:04:01 +00:00
parent 505e99587d
commit ac16bc8bf1
1 changed files with 8 additions and 3 deletions

View File

@ -66,12 +66,15 @@ def delete():
if passwordhash: if passwordhash:
if verify_hash == 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) result = subprocess.run(" ".join(cmd), shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode == 0: if result.returncode == 0:
# Command executed successfully # 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: else:
# Handle errors, log them, and return False # Handle errors, log them, and return False
error_message = result.stderr.decode("utf-8") error_message = result.stderr.decode("utf-8")
@ -93,8 +96,10 @@ def dashboard():
@app.route('/deleteacct') @app.route('/deleteacct')
def deleteacct(): def deleteacct():
email = request.cookies.get('email')
passwordhash = request.cookies.get('passwordhash')
if 'passwordhash' in request.cookies and 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: else:
return redirect(url_for('index')) return redirect(url_for('index'))