Add include_sender_in_reverse_alias on Setting page

This commit is contained in:
Son NK 2020-12-06 19:38:37 +01:00
parent ce2d68a64d
commit fec281b84f
2 changed files with 35 additions and 0 deletions

View file

@ -305,6 +305,31 @@
{% endif %}
<!-- END Reverse-alias -->
<!-- Sender included in reverse-alias -->
<div class="card" id="sender-in-ra">
<div class="card-body">
<div class="card-title">Include sender address in reverse-alias</div>
<div class="mb-3">
By default, the reverse-alias is randomly generated and doesn't contain any information about
the sender.<br>
You can however enable this option to include the sender address in the reverse-alias. <br>
This can be useful when setting up an email filter and makes the reverse-alias more readable.
</div>
<form method="post" action="#sender-in-ra">
<input type="hidden" name="form-name" value="sender-in-ra">
<div class="form-check">
<input type="checkbox" id="include-sender-ra" name="enable"
{% if current_user.include_sender_in_reverse_alias %} checked {% endif %} class="form-check-input">
<label for="include-sender-ra">Include sender address in reverse-alias</label>
</div>
<button type="submit" class="btn btn-outline-primary">Update</button>
</form>
</div>
</div>
<!-- END Reverse-alias -->
<div class="card">
<div class="card-body">
<div class="card-title">Quarantine</div>

View file

@ -255,6 +255,16 @@ def setting():
flash("Your preference has been updated", "success")
return redirect(url_for("dashboard.setting"))
elif request.form.get("form-name") == "sender-in-ra":
choose = request.form.get("enable")
if choose == "on":
current_user.include_sender_in_reverse_alias = True
else:
current_user.include_sender_in_reverse_alias = False
db.session.commit()
flash("Your preference has been updated", "success")
return redirect(url_for("dashboard.setting"))
elif request.form.get("form-name") == "export-data":
data = {
"email": current_user.email,