mirror of
https://github.com/simple-login/app.git
synced 2024-11-18 01:40:38 +01:00
Add refused-email view
This commit is contained in:
parent
9872672dcb
commit
18008460e6
4 changed files with 89 additions and 0 deletions
|
@ -17,4 +17,5 @@ from .views import (
|
||||||
mailbox,
|
mailbox,
|
||||||
deleted_alias,
|
deleted_alias,
|
||||||
mailbox_detail,
|
mailbox_detail,
|
||||||
|
refused_email,
|
||||||
)
|
)
|
||||||
|
|
39
app/dashboard/templates/dashboard/refused_email.html
Normal file
39
app/dashboard/templates/dashboard/refused_email.html
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{% extends 'default.html' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Refused Emails
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% set active_page = "setting" %}
|
||||||
|
|
||||||
|
{% block default_content %}
|
||||||
|
<div style="max-width: 60em; margin: auto">
|
||||||
|
<h1 class="h3 mb-5"> Refused Emails </h1>
|
||||||
|
|
||||||
|
{% if fels|length == 0 %}
|
||||||
|
<div class="my-4 p-4 card">
|
||||||
|
You don't have any refused email.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for fel in fels %}
|
||||||
|
{% set refused_email = fel.refused_email %}
|
||||||
|
{% set forward = fel.forward %}
|
||||||
|
|
||||||
|
<div class="card p-4 shadow-sm {% if fel.id == highlight_fel_id %} highlight-row {% endif %}">
|
||||||
|
From: {{ forward.website_from or forward.website_email }} <br>
|
||||||
|
To: {{ forward.gen_email.email }} <br>
|
||||||
|
<div class="small-text">
|
||||||
|
Sent {{ refused_email.created_at | dt }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="{{ refused_email.get_url() }}" class="mt-4">View →</a>
|
||||||
|
<div class="small-text">This will download a ".eml" file that you can open in your favorite email client</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -183,6 +183,25 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="card-title">Refused Emails
|
||||||
|
<div class="small-text mt-1 mb-3" style="max-width: 40rem">
|
||||||
|
When an email sent to your alias is classified as spam or refused by your email provider,
|
||||||
|
it usually means your alias has been leaked to a spammer. <br>
|
||||||
|
In this case SimpleLogin will keep a copy of this email (so it isn't lost)
|
||||||
|
and notify you so you can take a look at its content and take appropriate actions. <br>
|
||||||
|
|
||||||
|
The emails are deleted in 7 days.
|
||||||
|
This is an exceptional case where SimpleLogin stores the email.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a href="{{ url_for('dashboard.refused_email_route') }}" class="btn btn-outline-primary">
|
||||||
|
See refused emails
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="card-title">Export Data
|
<div class="card-title">Export Data
|
||||||
|
|
30
app/dashboard/views/refused_email.py
Normal file
30
app/dashboard/views/refused_email.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
from flask import render_template, request
|
||||||
|
from flask_login import login_required
|
||||||
|
|
||||||
|
from app.dashboard.base import dashboard_bp
|
||||||
|
from app.models import ForwardEmailLog
|
||||||
|
|
||||||
|
|
||||||
|
@dashboard_bp.route("/refused_email", methods=["GET", "POST"])
|
||||||
|
@login_required
|
||||||
|
def refused_email_route():
|
||||||
|
# Highlight a refused email
|
||||||
|
highlight_fel_id = request.args.get("highlight_fel_id")
|
||||||
|
if highlight_fel_id:
|
||||||
|
highlight_fel_id = int(highlight_fel_id)
|
||||||
|
|
||||||
|
fels: [ForwardEmailLog] = ForwardEmailLog.query.filter(
|
||||||
|
ForwardEmailLog.refused_email_id != None
|
||||||
|
).all()
|
||||||
|
|
||||||
|
# make sure the highlighted fel is the first fel
|
||||||
|
highlight_index = None
|
||||||
|
for ix, fel in enumerate(fels):
|
||||||
|
if fel.id == highlight_fel_id:
|
||||||
|
highlight_index = ix
|
||||||
|
break
|
||||||
|
|
||||||
|
if highlight_index:
|
||||||
|
fels.insert(0, fels.pop(highlight_index))
|
||||||
|
|
||||||
|
return render_template("dashboard/refused_email.html", **locals())
|
Loading…
Reference in a new issue