Skip to content

Commit 7c516f4

Browse files
committed
INTEGRITY: Add manual user email notificication log button
1 parent 909c69c commit 7c516f4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/app/fileset.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ def fileset():
239239
html += "<button type='submit' style='margin-left: 10px;'>Delete the Fileset</button>"
240240
html += "</form>"
241241

242+
# Manually log email notification
243+
html += f"""<form action="{url_for("manual_email_notification", fileset_id=id)}" method="POST" onsubmit="return confirm('Are you sure you want to log a user email notification for the given fileset?');">"""
244+
html += "<button type='submit' style='margin-left: 10px;'>Log User Email Notification</button>"
245+
html += "</form>"
246+
242247
# -------------------------------------------------------------------------------------------------
243248
# metadata
244249
# -------------------------------------------------------------------------------------------------
@@ -1953,12 +1958,16 @@ def delete_filtered_filesets():
19531958
return redirect("/logs")
19541959

19551960

1956-
@app.route("/email_notification/<int:fileset_id>", methods=["GET"])
1957-
def email_notification(fileset_id):
1961+
def log_user_email_notification(fileset_id):
19581962
connection = db_connect()
19591963
log_text = f"User email received for Fileset:{fileset_id}"
19601964
create_log("Email Received", "Mail Server", log_text, connection)
19611965
connection.commit()
1966+
1967+
1968+
@app.route("/email_notification/<int:fileset_id>", methods=["POST"])
1969+
def email_notification(fileset_id):
1970+
log_user_email_notification(fileset_id)
19621971
return jsonify(
19631972
{
19641973
"status": "success",
@@ -1968,5 +1977,11 @@ def email_notification(fileset_id):
19681977
), 200
19691978

19701979

1980+
@app.route("/manual_email_notification/<int:fileset_id>", methods=["POST"])
1981+
def manual_email_notification(fileset_id):
1982+
log_user_email_notification(fileset_id)
1983+
return redirect("/logs")
1984+
1985+
19711986
if __name__ == "__main__":
19721987
app.run(port=5001, debug=True, host="0.0.0.0")

0 commit comments

Comments
 (0)