Remove tokens when saving credentials

This commit is contained in:
oldnapalm
2023-10-11 13:15:44 -03:00
parent 91807a6d82
commit 02a4bfa636
+2 -1
View File
@@ -25,7 +25,7 @@ import xml.etree.ElementTree as ET
from copy import deepcopy
from functools import wraps
from io import BytesIO
from shutil import copyfile
from shutil import copyfile, rmtree
from logging.handlers import RotatingFileHandler
from urllib.parse import quote
from flask import Flask, request, jsonify, redirect, render_template, url_for, flash, session, abort, make_response, send_file, send_from_directory
@@ -820,6 +820,7 @@ def garmin(username):
flash("Garmin credentials can't be empty.")
return render_template("garmin.html", username=current_user.username)
encrypt_credentials(file, (request.form['username'], request.form['password']))
rmtree('%s/%s/garth' % (STORAGE_DIR, current_user.player_id), ignore_errors=True)
return redirect(url_for('settings', username=current_user.username))
cred = decrypt_credentials(file)
return render_template("garmin.html", username=current_user.username, uname=cred[0], passw=cred[1])