remove "set-mailbox" form post
This commit is contained in:
parent
1a081f87c4
commit
a2666cc4fe
|
@ -215,7 +215,6 @@
|
|||
<div class="collapse" id="alias-{{ alias.id }}">
|
||||
|
||||
{% if mailboxes|length > 1 %}
|
||||
<form method="post">
|
||||
<div class="small-text mt-2">Current mailbox</div>
|
||||
<div class="d-flex">
|
||||
<div class="flex-grow-1 mr-2">
|
||||
|
@ -231,9 +230,6 @@
|
|||
</div>
|
||||
|
||||
<div class="">
|
||||
<input type="hidden" name="form-name" value="set-mailbox">
|
||||
<input type="hidden" name="alias-id" value="{{ alias.id }}">
|
||||
|
||||
<a data-alias="{{ alias.id }}"
|
||||
class="save-mailbox btn btn-sm btn-outline-info w-100">
|
||||
Update
|
||||
|
@ -241,7 +237,6 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
{% elif alias_info.mailbox != None and alias_info.mailbox.email != current_user.email %}
|
||||
<div class="small-text">
|
||||
Owned by <b>{{ alias_info.mailbox.email }}</b> mailbox
|
||||
|
|
|
@ -87,30 +87,7 @@ def index():
|
|||
LOG.error("alias %s has been added before to DeletedAlias", email)
|
||||
db.session.rollback()
|
||||
|
||||
|
||||
elif request.form.get("form-name") == "set-mailbox":
|
||||
alias_id = request.form.get("alias-id")
|
||||
alias: Alias = Alias.get(alias_id)
|
||||
mailbox_email = request.form.get("mailbox")
|
||||
|
||||
mailbox = Mailbox.get_by(email=mailbox_email)
|
||||
if not mailbox or mailbox.user_id != current_user.id:
|
||||
flash("Something went wrong, please retry", "warning")
|
||||
else:
|
||||
alias.mailbox_id = mailbox.id
|
||||
db.session.commit()
|
||||
LOG.d("Set alias %s mailbox to %s", alias, mailbox)
|
||||
|
||||
flash(
|
||||
f"Update mailbox for {alias.email} to {mailbox_email}", "success",
|
||||
)
|
||||
return redirect(
|
||||
url_for(
|
||||
"dashboard.index", highlight_alias_id=alias.id, query=query,
|
||||
)
|
||||
)
|
||||
|
||||
return redirect(url_for("dashboard.index", query=query))
|
||||
return redirect(url_for("dashboard.index", query=query, sort=sort))
|
||||
|
||||
client_users = (
|
||||
ClientUser.filter_by(user_id=current_user.id)
|
||||
|
|
Loading…
Reference in a new issue