mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 07:43:54 +08:00
user can delete email alias
This commit is contained in:
parent
62cbcb249b
commit
df3292df37
2 changed files with 32 additions and 6 deletions
|
@ -39,7 +39,7 @@
|
||||||
<th>
|
<th>
|
||||||
Enable/Disable Email Forwarding
|
Enable/Disable Email Forwarding
|
||||||
</th>
|
</th>
|
||||||
<th>Created At</th>
|
<th>Delete</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -104,8 +104,16 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{{ gen_email.created_at | dt }}
|
<form method="post">
|
||||||
|
<input type="hidden" name="form-name" value="delete-email">
|
||||||
|
<input type="hidden" name="gen-email-id" value="{{ gen_email.id }}">
|
||||||
|
<a href="javascript:{}"
|
||||||
|
class="icon delete-email">
|
||||||
|
<i class="fe fe-trash"></i>
|
||||||
|
</a>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
@ -212,10 +220,18 @@
|
||||||
e.clearSelection();
|
e.clearSelection();
|
||||||
});
|
});
|
||||||
|
|
||||||
// the modal does not get close when user clicks outside of modal
|
$(".delete-email").on("click", function (e) {
|
||||||
// necessary for obligatory modal such as the one displayed when user enable/display email forwarding
|
notie.confirm({
|
||||||
notie.setOptions({
|
text: "Once an email alias is deleted, people/apps " +
|
||||||
overlayClickDismiss: false,
|
"who used to contact you via this email cannot reach you any more," +
|
||||||
|
" please confirm",
|
||||||
|
cancelCallback: () => {
|
||||||
|
// nothing to do
|
||||||
|
},
|
||||||
|
submitCallback: () => {
|
||||||
|
$(this).closest("form").submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".custom-switch-input").change(function (e) {
|
$(".custom-switch-input").change(function (e) {
|
||||||
|
|
|
@ -66,6 +66,16 @@ SimpleLogin team.
|
||||||
)
|
)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
elif request.form.get("form-name") == "delete-email":
|
||||||
|
gen_email_id = request.form.get("gen-email-id")
|
||||||
|
gen_email: GenEmail = GenEmail.get(gen_email_id)
|
||||||
|
|
||||||
|
LOG.d("delete gen email %s", gen_email)
|
||||||
|
email = gen_email.email
|
||||||
|
GenEmail.delete(gen_email.id)
|
||||||
|
db.session.commit()
|
||||||
|
flash(f"Email alias {email} has been deleted", "success")
|
||||||
|
|
||||||
return redirect(url_for("dashboard.index"))
|
return redirect(url_for("dashboard.index"))
|
||||||
|
|
||||||
client_users = (
|
client_users = (
|
||||||
|
|
Loading…
Reference in a new issue