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