diff --git a/app/routes.py b/app/routes.py index 7862fd0..dff6309 100644 --- a/app/routes.py +++ b/app/routes.py @@ -169,12 +169,12 @@ def delete(id): data = Config.files.find_one({"id": id}) - if data["userid"] == current_user.userid: + if data["userid"] == request.form.get("userid") and bcrypt.check_password_hash(Config.user.find_one({"userid": data["userid"]})["idpass"], request.form.get("idpass")): Config.files.delete_one({"id": id}) os.remove(os.path.join(Config.fileDir, secure_filename(id))) return "File deleted." - elif data["userid"] == request.form.get("userid") and bcrypt.check_password_hash(Config.user.find_one({"userid": data["userid"]})["idpass"], request.form.get("idpass")): + elif data["userid"] == current_user.userid: Config.files.delete_one({"id": id}) os.remove(os.path.join(Config.fileDir, secure_filename(id))) return "File deleted."