Merge pull request #19 from simple-login/sqlalchemy-sentry
Sqlalchemy sentry
This commit is contained in:
commit
c926a95be3
|
@ -56,6 +56,9 @@
|
|||
<div class="text-danger mt-4">
|
||||
Your DNS is not correctly set. The MX record we obtain is:
|
||||
<div class="mb-3 p-3" style="background-color: #eee">
|
||||
{% if not mx_errors %}
|
||||
(Empty)
|
||||
{% endif %}
|
||||
{% for r in mx_errors %}
|
||||
{{ r }} <br>
|
||||
{% endfor %}
|
||||
|
@ -112,6 +115,10 @@
|
|||
<div class="text-danger mt-4">
|
||||
Your DNS is not correctly set. The TXT record we obtain is:
|
||||
<div class="mb-3 p-3" style="background-color: #eee">
|
||||
{% if not spf_errors %}
|
||||
(Empty)
|
||||
{% endif %}
|
||||
|
||||
{% for r in spf_errors %}
|
||||
{{ r }} <br>
|
||||
{% endfor %}
|
||||
|
|
|
@ -152,16 +152,15 @@
|
|||
{% if alias_info.show_intro_test_send_email %}
|
||||
data-intro="Not only alias can receive emails, it can <em>send</em> emails too! <br><br>
|
||||
You can add a new <em>contact</em> to for your alias here. <br><br>
|
||||
To send an email to your contact, SimpleLogin will create a <em>special</em> email address: <br>
|
||||
sending an email to this email address will <em>forward</em> your email to your contact"
|
||||
To send an email to your contact, SimpleLogin will create a <em>special</em> email address. <br><br>
|
||||
Sending an email to this email address will <em>forward</em> the email to your contact"
|
||||
data-step="4"
|
||||
{% endif %}
|
||||
class="btn btn-sm btn-outline-primary"
|
||||
data-toggle="tooltip"
|
||||
title="Send email from alias"
|
||||
title="Not only an alias can receive emails, it can send emails too"
|
||||
>
|
||||
Send Email
|
||||
<span class="badge badge-info">Beta</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -34,6 +34,7 @@ def domain_detail_dns(custom_domain_id):
|
|||
mx_domains = get_mx_domains(custom_domain.domain)
|
||||
|
||||
if sorted(mx_domains) != sorted(EMAIL_SERVERS_WITH_PRIORITY):
|
||||
flash("The MX record is not correctly set", "warning")
|
||||
mx_ok = False
|
||||
# build mx_errors to show to user
|
||||
mx_errors = [
|
||||
|
@ -63,7 +64,10 @@ def domain_detail_dns(custom_domain_id):
|
|||
)
|
||||
)
|
||||
else:
|
||||
flash(f"{EMAIL_DOMAIN} is not included in your SPF record.", "warning")
|
||||
flash(
|
||||
f"SPF: {EMAIL_DOMAIN} is not included in your SPF record.",
|
||||
"warning",
|
||||
)
|
||||
spf_ok = False
|
||||
spf_errors = get_txt_record(custom_domain.domain)
|
||||
|
||||
|
@ -81,6 +85,7 @@ def domain_detail_dns(custom_domain_id):
|
|||
)
|
||||
)
|
||||
else:
|
||||
flash("DKIM: the TXT record is not correctly set", "warning")
|
||||
dkim_ok = False
|
||||
dkim_errors = get_txt_record(f"dkim._domainkey.{custom_domain.domain}")
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ def get_mx_domains(hostname) -> [(int, str)]:
|
|||
"""
|
||||
try:
|
||||
answers = dns.resolver.query(hostname, "MX")
|
||||
except dns.resolver.NoAnswer:
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
ret = []
|
||||
|
@ -28,7 +28,7 @@ def get_spf_domain(hostname) -> [str]:
|
|||
"""return all domains listed in *include:*"""
|
||||
try:
|
||||
answers = dns.resolver.query(hostname, "TXT")
|
||||
except dns.resolver.NoAnswer:
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
ret = []
|
||||
|
@ -49,7 +49,7 @@ def get_spf_domain(hostname) -> [str]:
|
|||
def get_txt_record(hostname) -> [str]:
|
||||
try:
|
||||
answers = dns.resolver.query(hostname, "TXT")
|
||||
except dns.resolver.NoAnswer:
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
ret = []
|
||||
|
@ -67,7 +67,7 @@ def get_dkim_record(hostname) -> str:
|
|||
"""query the dkim._domainkey.{hostname} record and returns its value"""
|
||||
try:
|
||||
answers = dns.resolver.query(f"dkim._domainkey.{hostname}", "TXT")
|
||||
except dns.resolver.NoAnswer:
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
ret = []
|
||||
|
|
14
server.py
14
server.py
|
@ -9,6 +9,9 @@ from flask_admin import Admin
|
|||
from flask_cors import cross_origin
|
||||
from flask_login import current_user
|
||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
|
||||
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
|
||||
|
||||
|
||||
from app import paddle_utils
|
||||
from app.admin_model import SLModelView, SLAdminIndexView
|
||||
|
@ -48,7 +51,14 @@ from app.oauth.base import oauth_bp
|
|||
|
||||
if SENTRY_DSN:
|
||||
LOG.d("enable sentry")
|
||||
sentry_sdk.init(dsn=SENTRY_DSN, integrations=[FlaskIntegration()])
|
||||
sentry_sdk.init(
|
||||
dsn=SENTRY_DSN,
|
||||
integrations=[
|
||||
FlaskIntegration(),
|
||||
SqlalchemyIntegration(),
|
||||
AioHttpIntegration(),
|
||||
],
|
||||
)
|
||||
|
||||
# the app is served behin nginx which uses http and not https
|
||||
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
|
||||
|
@ -185,7 +195,7 @@ def register_blueprints(app: Flask):
|
|||
|
||||
|
||||
def set_index_page(app):
|
||||
@app.route("/")
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for("dashboard.index"))
|
||||
|
|
Loading…
Reference in a new issue