remove form POST switch-email-forwarding
This commit is contained in:
parent
bbcd4fc355
commit
fb9dc23529
|
@ -110,9 +110,6 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<form method="post">
|
||||
<input type="hidden" name="form-name" value="switch-email-forwarding">
|
||||
<input type="hidden" name="alias-id" value="{{ alias.id }}">
|
||||
<label class="custom-switch cursor"
|
||||
data-toggle="tooltip"
|
||||
{% if alias.enabled %}
|
||||
|
@ -131,13 +128,13 @@
|
|||
{% endif %}
|
||||
style="padding-left: 0px"
|
||||
>
|
||||
<input type="hidden" name="alias" class="alias" value="{{ alias.email }}">
|
||||
<input type="checkbox" class="custom-switch-input" data-alias="{{ alias.id }}"
|
||||
<input type="checkbox" class="custom-switch-input"
|
||||
data-alias="{{ alias.id }}"
|
||||
data-alias-email="{{ alias.email }}"
|
||||
{{ "checked" if alias.enabled else "" }}>
|
||||
|
||||
<span class="custom-switch-indicator"></span>
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -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`, {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue