From fb9dc2352903a43253e45767f8ff2ccc0e8e307c Mon Sep 17 00:00:00 2001 From: Son NK Date: Sat, 25 Apr 2020 15:26:07 +0200 Subject: [PATCH] remove form POST switch-email-forwarding --- app/dashboard/templates/dashboard/index.html | 51 +++++++++----------- app/dashboard/views/index.py | 17 ------- 2 files changed, 24 insertions(+), 44 deletions(-) diff --git a/app/dashboard/templates/dashboard/index.html b/app/dashboard/templates/dashboard/index.html index dab6005d..340cb50e 100644 --- a/app/dashboard/templates/dashboard/index.html +++ b/app/dashboard/templates/dashboard/index.html @@ -110,34 +110,31 @@
-
- - - -
+ +
@@ -412,7 +409,7 @@ $(".custom-switch-input").change(async function (e) { let aliasId = $(this).data("alias"); - let alias = $(this).parent().find(".alias").val(); + let alias = $(this).data("alias-email"); try { let res = await fetch(`/api/aliases/${aliasId}/toggle`, { diff --git a/app/dashboard/views/index.py b/app/dashboard/views/index.py index 6f94a600..433e934e 100644 --- a/app/dashboard/views/index.py +++ b/app/dashboard/views/index.py @@ -63,23 +63,6 @@ def index(): else: flash(f"You need to upgrade your plan to create new alias.", "warning") - elif request.form.get("form-name") == "switch-email-forwarding": - alias_id = request.form.get("alias-id") - alias: Alias = Alias.get(alias_id) - - LOG.d("switch email forwarding for %s", alias) - - alias.enabled = not alias.enabled - if alias.enabled: - flash(f"Alias {alias.email} is enabled", "success") - else: - flash(f"Alias {alias.email} is disabled", "warning") - - db.session.commit() - return redirect( - url_for("dashboard.index", highlight_alias_id=alias.id, query=query) - ) - elif request.form.get("form-name") == "delete-email": alias_id = request.form.get("alias-id") alias: Alias = Alias.get(alias_id)