Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
822855d584 | |||
1a6a7e079b | |||
5210cb6515 | |||
b643f0644b | |||
5d093db4f6 | |||
0b16fcac67 | |||
a0d294da53 | |||
c3f755aede |
@ -31,9 +31,15 @@ steps:
|
||||
|
||||
- name: notify
|
||||
image: plugins/slack
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
settings:
|
||||
webhook:
|
||||
from_secret: slack_webhook
|
||||
icon_url:
|
||||
from_secret: slack_avatar
|
||||
|
||||
trigger:
|
||||
event:
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Simple Login
|
||||
|
||||
[](https://drone.mrmeeb.stream/MrMeeb/simple-login)
|
||||
|
||||
This repo exists to automatically capture any releases of the SaaS edition of SimpleLogin. It checks once a day, and builds the latest one automatically if it is newer than the currentlty built version.
|
||||
|
||||
This exists to simplify deployment of SimpleLogin in a self-hosted capacity, while also allowing the use of the latest version; SimpleLogin do not provide an up-to-date version for this use.
|
||||
|
@ -21,3 +21,4 @@ repos:
|
||||
- id: djlint-jinja
|
||||
files: '.*\.html'
|
||||
entry: djlint --reformat
|
||||
|
||||
|
@ -334,6 +334,12 @@ smtpd_recipient_restrictions =
|
||||
permit
|
||||
```
|
||||
|
||||
Check that the ssl certificates `/etc/ssl/certs/ssl-cert-snakeoil.pem` and `/etc/ssl/private/ssl-cert-snakeoil.key` exist. Depending on the linux distribution you are using they may or may not be present. If they are not, you will need to generate them with this command:
|
||||
|
||||
```bash
|
||||
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
```
|
||||
|
||||
Create the `/etc/postfix/pgsql-relay-domains.cf` file with the following content.
|
||||
Make sure that the database config is correctly set, replace `mydomain.com` with your domain, update 'myuser' and 'mypassword' with your postgres credentials.
|
||||
|
||||
|
@ -9,13 +9,17 @@ from newrelic import agent
|
||||
from app.db import Session
|
||||
from app.email_utils import send_welcome_email
|
||||
from app.utils import sanitize_email
|
||||
from app.errors import AccountAlreadyLinkedToAnotherPartnerException
|
||||
from app.errors import (
|
||||
AccountAlreadyLinkedToAnotherPartnerException,
|
||||
AccountIsUsingAliasAsEmail,
|
||||
)
|
||||
from app.log import LOG
|
||||
from app.models import (
|
||||
PartnerSubscription,
|
||||
Partner,
|
||||
PartnerUser,
|
||||
User,
|
||||
Alias,
|
||||
)
|
||||
from app.utils import random_string
|
||||
|
||||
@ -192,11 +196,18 @@ def get_login_strategy(
|
||||
return ExistingUnlinkedUserStrategy(link_request, user, partner)
|
||||
|
||||
|
||||
def check_alias(email: str) -> bool:
|
||||
alias = Alias.get_by(email=email)
|
||||
if alias is not None:
|
||||
raise AccountIsUsingAliasAsEmail()
|
||||
|
||||
|
||||
def process_login_case(
|
||||
link_request: PartnerLinkRequest, partner: Partner
|
||||
) -> LinkResult:
|
||||
# Sanitize email just in case
|
||||
link_request.email = sanitize_email(link_request.email)
|
||||
check_alias(link_request.email)
|
||||
# Try to find a SimpleLogin user registered with that partner user id
|
||||
partner_user = PartnerUser.get_by(
|
||||
partner_id=partner.id, external_user_id=link_request.external_user_id
|
||||
|
@ -620,3 +620,8 @@ class MetricAdmin(SLModelView):
|
||||
column_exclude_list = ["created_at", "updated_at", "id"]
|
||||
|
||||
can_export = True
|
||||
|
||||
|
||||
class InvalidMailboxDomainAdmin(SLModelView):
|
||||
can_create = True
|
||||
can_delete = True
|
||||
|
@ -86,7 +86,7 @@ def delete_mailbox(mailbox_id):
|
||||
|
||||
"""
|
||||
user = g.user
|
||||
mailbox = Mailbox.get(id=mailbox_id)
|
||||
mailbox = Mailbox.get(mailbox_id)
|
||||
|
||||
if not mailbox or mailbox.user_id != user.id:
|
||||
return jsonify(error="Forbidden"), 403
|
||||
|
@ -111,11 +111,15 @@ POSTFIX_SERVER = os.environ.get("POSTFIX_SERVER", "240.0.0.1")
|
||||
DISABLE_REGISTRATION = "DISABLE_REGISTRATION" in os.environ
|
||||
|
||||
# allow using a different postfix port, useful when developing locally
|
||||
POSTFIX_PORT = int(os.environ.get("POSTFIX_PORT", 25))
|
||||
|
||||
# Use port 587 instead of 25 when sending emails through Postfix
|
||||
# Useful when calling Postfix from an external network
|
||||
POSTFIX_SUBMISSION_TLS = "POSTFIX_SUBMISSION_TLS" in os.environ
|
||||
if POSTFIX_SUBMISSION_TLS:
|
||||
default_postfix_port = 587
|
||||
else:
|
||||
default_postfix_port = 25
|
||||
POSTFIX_PORT = int(os.environ.get("POSTFIX_PORT", default_postfix_port))
|
||||
POSTFIX_TIMEOUT = os.environ.get("POSTFIX_TIMEOUT", 3)
|
||||
|
||||
# ["domain1.com", "domain2.com"]
|
||||
|
@ -150,7 +150,13 @@ def index():
|
||||
flash(f"Alias {alias.email} has been disabled", "success")
|
||||
|
||||
return redirect(
|
||||
url_for("dashboard.index", query=query, sort=sort, filter=alias_filter)
|
||||
url_for(
|
||||
"dashboard.index",
|
||||
query=query,
|
||||
sort=sort,
|
||||
filter=alias_filter,
|
||||
page=page,
|
||||
)
|
||||
)
|
||||
|
||||
mailboxes = current_user.mailboxes()
|
||||
|
@ -69,17 +69,20 @@ def mailbox_route():
|
||||
transfer_mailbox = Mailbox.get(transfer_mailbox_id)
|
||||
|
||||
if not transfer_mailbox or transfer_mailbox.user_id != current_user.id:
|
||||
flash("You must transfer the aliases to a mailbox you own.")
|
||||
flash(
|
||||
"You must transfer the aliases to a mailbox you own.", "error"
|
||||
)
|
||||
return redirect(url_for("dashboard.mailbox_route"))
|
||||
|
||||
if transfer_mailbox.id == mailbox.id:
|
||||
flash(
|
||||
"You can not transfer the aliases to the mailbox you want to delete."
|
||||
"You can not transfer the aliases to the mailbox you want to delete.",
|
||||
"error",
|
||||
)
|
||||
return redirect(url_for("dashboard.mailbox_route"))
|
||||
|
||||
if not transfer_mailbox.verified:
|
||||
flash("Your new mailbox is not verified")
|
||||
flash("Your new mailbox is not verified", "error")
|
||||
return redirect(url_for("dashboard.mailbox_route"))
|
||||
|
||||
# Schedule delete account job
|
||||
@ -147,12 +150,12 @@ def mailbox_route():
|
||||
elif not email_can_be_used_as_mailbox(mailbox_email):
|
||||
flash(f"You cannot use {mailbox_email}.", "error")
|
||||
else:
|
||||
transfer_mailbox = Mailbox.create(
|
||||
new_mailbox = Mailbox.create(
|
||||
email=mailbox_email, user_id=current_user.id
|
||||
)
|
||||
Session.commit()
|
||||
|
||||
send_verification_email(current_user, transfer_mailbox)
|
||||
send_verification_email(current_user, new_mailbox)
|
||||
|
||||
flash(
|
||||
f"You are going to receive an email to confirm {mailbox_email}.",
|
||||
@ -162,7 +165,7 @@ def mailbox_route():
|
||||
return redirect(
|
||||
url_for(
|
||||
"dashboard.mailbox_detail_route",
|
||||
mailbox_id=transfer_mailbox.id,
|
||||
mailbox_id=new_mailbox.id,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -60,4 +60,5 @@ E522 = (
|
||||
)
|
||||
E523 = "550 SL E523 Unknown error"
|
||||
E524 = "550 SL E524 Wrong use of reverse-alias"
|
||||
E525 = "550 SL E525 Alias loop"
|
||||
# endregion
|
||||
|
@ -71,7 +71,7 @@ class ErrContactErrorUpgradeNeeded(SLException):
|
||||
"""raised when user cannot create a contact because the plan doesn't allow it"""
|
||||
|
||||
def error_for_user(self) -> str:
|
||||
return f"Please upgrade to premium to create reverse-alias"
|
||||
return "Please upgrade to premium to create reverse-alias"
|
||||
|
||||
|
||||
class ErrAddressInvalid(SLException):
|
||||
@ -108,3 +108,8 @@ class AccountAlreadyLinkedToAnotherPartnerException(LinkException):
|
||||
class AccountAlreadyLinkedToAnotherUserException(LinkException):
|
||||
def __init__(self):
|
||||
super().__init__("This account is linked to another user")
|
||||
|
||||
|
||||
class AccountIsUsingAliasAsEmail(LinkException):
|
||||
def __init__(self):
|
||||
super().__init__("Your account has an alias as it's email address")
|
||||
|
@ -17,7 +17,7 @@ from attr import dataclass
|
||||
from app import config
|
||||
from app.email import headers
|
||||
from app.log import LOG
|
||||
from app.message_utils import message_to_bytes
|
||||
from app.message_utils import message_to_bytes, message_format_base64_parts
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -117,14 +117,12 @@ class MailSender:
|
||||
return True
|
||||
|
||||
def _send_to_smtp(self, send_request: SendRequest, retries: int) -> bool:
|
||||
if config.POSTFIX_SUBMISSION_TLS and config.POSTFIX_PORT == 25:
|
||||
smtp_port = 587
|
||||
else:
|
||||
smtp_port = config.POSTFIX_PORT
|
||||
try:
|
||||
start = time.time()
|
||||
with SMTP(
|
||||
config.POSTFIX_SERVER, smtp_port, timeout=config.POSTFIX_TIMEOUT
|
||||
config.POSTFIX_SERVER,
|
||||
config.POSTFIX_PORT,
|
||||
timeout=config.POSTFIX_TIMEOUT,
|
||||
) as smtp:
|
||||
if config.POSTFIX_SUBMISSION_TLS:
|
||||
smtp.starttls()
|
||||
@ -170,13 +168,17 @@ class MailSender:
|
||||
LOG.e(f"Ignore smtp error {e}")
|
||||
return False
|
||||
LOG.e(
|
||||
f"Could not send message to smtp server {config.POSTFIX_SERVER}:{smtp_port}"
|
||||
f"Could not send message to smtp server {config.POSTFIX_SERVER}:{config.POSTFIX_PORT}"
|
||||
)
|
||||
self._save_request_to_unsent_dir(send_request)
|
||||
return False
|
||||
|
||||
def _save_request_to_unsent_dir(self, send_request: SendRequest):
|
||||
file_name = f"DeliveryFail-{int(time.time())}-{uuid.uuid4()}.{SendRequest.SAVE_EXTENSION}"
|
||||
def _save_request_to_unsent_dir(
|
||||
self, send_request: SendRequest, prefix: str = "DeliveryFail"
|
||||
):
|
||||
file_name = (
|
||||
f"{prefix}-{int(time.time())}-{uuid.uuid4()}.{SendRequest.SAVE_EXTENSION}"
|
||||
)
|
||||
file_path = os.path.join(config.SAVE_UNSENT_DIR, file_name)
|
||||
file_contents = send_request.to_bytes()
|
||||
with open(file_path, "wb") as fd:
|
||||
@ -258,7 +260,7 @@ def sl_sendmail(
|
||||
send_request = SendRequest(
|
||||
envelope_from,
|
||||
envelope_to,
|
||||
msg,
|
||||
message_format_base64_parts(msg),
|
||||
mail_options,
|
||||
rcpt_options,
|
||||
is_forward,
|
||||
|
@ -1,21 +1,42 @@
|
||||
import re
|
||||
from email import policy
|
||||
from email.message import Message
|
||||
|
||||
from app.email import headers
|
||||
from app.log import LOG
|
||||
|
||||
# Spam assassin might flag as spam with a different line length
|
||||
BASE64_LINELENGTH = 76
|
||||
|
||||
|
||||
def message_to_bytes(msg: Message) -> bytes:
|
||||
"""replace Message.as_bytes() method by trying different policies"""
|
||||
for generator_policy in [None, policy.SMTP, policy.SMTPUTF8]:
|
||||
try:
|
||||
return msg.as_bytes(policy=generator_policy)
|
||||
except:
|
||||
except Exception:
|
||||
LOG.w("as_bytes() fails with %s policy", policy, exc_info=True)
|
||||
|
||||
msg_string = msg.as_string()
|
||||
try:
|
||||
return msg_string.encode()
|
||||
except:
|
||||
except Exception:
|
||||
LOG.w("as_string().encode() fails", exc_info=True)
|
||||
|
||||
return msg_string.encode(errors="replace")
|
||||
|
||||
|
||||
def message_format_base64_parts(msg: Message) -> Message:
|
||||
for part in msg.walk():
|
||||
if part.get(
|
||||
headers.CONTENT_TRANSFER_ENCODING
|
||||
) == "base64" and part.get_content_type() in ("text/plain", "text/html"):
|
||||
# Remove line breaks
|
||||
body = re.sub("[\r\n]", "", part.get_payload())
|
||||
# Split in 80 column lines
|
||||
chunks = [
|
||||
body[i : i + BASE64_LINELENGTH]
|
||||
for i in range(0, len(body), BASE64_LINELENGTH)
|
||||
]
|
||||
part.set_payload("\r\n".join(chunks))
|
||||
return msg
|
||||
|
@ -1641,6 +1641,8 @@ class Contact(Base, ModelMixin):
|
||||
Store configuration of sender (website-email) and alias.
|
||||
"""
|
||||
|
||||
MAX_NAME_LENGTH = 512
|
||||
|
||||
__tablename__ = "contact"
|
||||
|
||||
__table_args__ = (
|
||||
|
@ -168,7 +168,7 @@ from app.pgp_utils import (
|
||||
sign_data,
|
||||
load_public_key_and_check,
|
||||
)
|
||||
from app.utils import sanitize_email
|
||||
from app.utils import sanitize_email, canonicalize_email
|
||||
from init_app import load_pgp_public_keys
|
||||
from server import create_light_app
|
||||
|
||||
@ -182,6 +182,10 @@ def get_or_create_contact(from_header: str, mail_from: str, alias: Alias) -> Con
|
||||
except ValueError:
|
||||
contact_name, contact_email = "", ""
|
||||
|
||||
# Ensure contact_name is within limits
|
||||
if len(contact_name) >= Contact.MAX_NAME_LENGTH:
|
||||
contact_name = contact_name[0 : Contact.MAX_NAME_LENGTH]
|
||||
|
||||
if not is_valid_email(contact_email):
|
||||
# From header is wrongly formatted, try with mail_from
|
||||
if mail_from and mail_from != "<>":
|
||||
@ -689,6 +693,36 @@ def handle_forward(envelope, msg: Message, rcpt_to: str) -> List[Tuple[bool, str
|
||||
LOG.d("%s unverified, do not forward", mailbox)
|
||||
ret.append((False, status.E517))
|
||||
else:
|
||||
# Check if the mailbox is also an alias and stop the loop
|
||||
mailbox_as_alias = Alias.get_by(email=mailbox.email)
|
||||
if mailbox_as_alias is not None:
|
||||
LOG.info(
|
||||
f"Mailbox {mailbox.id} has email {mailbox.email} that is also alias {alias.id}. Stopping loop"
|
||||
)
|
||||
mailbox.verified = False
|
||||
Session.commit()
|
||||
mailbox_url = f"{URL}/dashboard/mailbox/{mailbox.id}/"
|
||||
send_email_with_rate_control(
|
||||
user,
|
||||
ALERT_MAILBOX_IS_ALIAS,
|
||||
user.email,
|
||||
f"Your mailbox {mailbox.email} is an alias",
|
||||
render(
|
||||
"transactional/mailbox-invalid.txt.jinja2",
|
||||
mailbox=mailbox,
|
||||
mailbox_url=mailbox_url,
|
||||
alias=alias,
|
||||
),
|
||||
render(
|
||||
"transactional/mailbox-invalid.html",
|
||||
mailbox=mailbox,
|
||||
mailbox_url=mailbox_url,
|
||||
alias=alias,
|
||||
),
|
||||
max_nb_alert=1,
|
||||
)
|
||||
ret.append((False, status.E525))
|
||||
continue
|
||||
# create a copy of message for each forward
|
||||
ret.append(
|
||||
forward_email_to_mailbox(
|
||||
@ -836,10 +870,12 @@ def forward_email_to_mailbox(
|
||||
orig_subject = msg[headers.SUBJECT]
|
||||
orig_subject = get_header_unicode(orig_subject)
|
||||
add_or_replace_header(msg, "Subject", mailbox.generic_subject)
|
||||
sender = msg[headers.FROM]
|
||||
sender = get_header_unicode(sender)
|
||||
msg = add_header(
|
||||
msg,
|
||||
f"""Forwarded by SimpleLogin to {alias.email} with "{orig_subject}" as subject""",
|
||||
f"""Forwarded by SimpleLogin to {alias.email} with <b>{orig_subject}</b> as subject""",
|
||||
f"""Forwarded by SimpleLogin to {alias.email} from "{sender}" with "{orig_subject}" as subject""",
|
||||
f"""Forwarded by SimpleLogin to {alias.email} from "{sender}" with <b>{orig_subject}</b> as subject""",
|
||||
)
|
||||
|
||||
try:
|
||||
@ -1384,12 +1420,14 @@ def get_mailbox_from_mail_from(mail_from: str, alias) -> Optional[Mailbox]:
|
||||
"""return the corresponding mailbox given the mail_from and alias
|
||||
Usually the mail_from=mailbox.email but it can also be one of the authorized address
|
||||
"""
|
||||
|
||||
def __check(email_address: str, alias: Alias) -> Optional[Mailbox]:
|
||||
for mailbox in alias.mailboxes:
|
||||
if mailbox.email == mail_from:
|
||||
if mailbox.email == email_address:
|
||||
return mailbox
|
||||
|
||||
for authorized_address in mailbox.authorized_addresses:
|
||||
if authorized_address.email == mail_from:
|
||||
if authorized_address.email == email_address:
|
||||
LOG.d(
|
||||
"Found an authorized address for %s %s %s",
|
||||
alias,
|
||||
@ -1397,9 +1435,12 @@ def get_mailbox_from_mail_from(mail_from: str, alias) -> Optional[Mailbox]:
|
||||
authorized_address,
|
||||
)
|
||||
return mailbox
|
||||
|
||||
return None
|
||||
|
||||
# We need to first check for the uncanonicalized version because we still have users in the db with the
|
||||
# email non canonicalized. So if it matches the already existing one use that, otherwise check the canonical one
|
||||
return __check(mail_from, alias) or __check(canonicalize_email(mail_from), alias)
|
||||
|
||||
|
||||
def handle_unknown_mailbox(
|
||||
envelope, msg, reply_email: str, user: User, alias: Alias, contact: Contact
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -44,6 +44,7 @@ from app.admin_model import (
|
||||
NewsletterUserAdmin,
|
||||
DailyMetricAdmin,
|
||||
MetricAdmin,
|
||||
InvalidMailboxDomainAdmin,
|
||||
)
|
||||
from app.api.base import api_bp
|
||||
from app.auth.base import auth_bp
|
||||
@ -105,6 +106,7 @@ from app.models import (
|
||||
NewsletterUser,
|
||||
DailyMetric,
|
||||
Metric2,
|
||||
InvalidMailboxDomain,
|
||||
)
|
||||
from app.monitor.base import monitor_bp
|
||||
from app.newsletter_utils import send_newsletter_to_user
|
||||
@ -764,6 +766,7 @@ def init_admin(app):
|
||||
admin.add_view(NewsletterUserAdmin(NewsletterUser, Session))
|
||||
admin.add_view(DailyMetricAdmin(DailyMetric, Session))
|
||||
admin.add_view(MetricAdmin(Metric2, Session))
|
||||
admin.add_view(InvalidMailboxDomainAdmin(InvalidMailboxDomain, Session))
|
||||
|
||||
|
||||
def register_custom_commands(app):
|
||||
|
@ -50,7 +50,9 @@
|
||||
</p>
|
||||
<p>
|
||||
This Youtube video can also quickly walk you through the steps:
|
||||
<a href="https://www.youtube.com/watch?v=VsypF-DBaow" target="_blank">
|
||||
<a href="https://www.youtube.com/watch?v=VsypF-DBaow"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
How to send emails from an alias <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
</p>
|
||||
|
@ -23,7 +23,9 @@
|
||||
|
||||
<div class="alert alert-danger" role="alert">
|
||||
This feature is only available on Premium plan.
|
||||
<a href="{{ URL }}/dashboard/pricing" target="_blank" rel="noopener">
|
||||
<a href="{{ URL }}/dashboard/pricing"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Upgrade<i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -78,7 +78,7 @@
|
||||
data-clipboard-text=".*suffix">.*suffix</em>
|
||||
<br />
|
||||
To test out regex, we recommend using regex tester tool like
|
||||
<a href="https://regex101.com" target="_blank">https://regex101.com↗</a>
|
||||
<a href="https://regex101.com" target="_blank" rel="noopener noreferrer">https://regex101.com↗</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -158,7 +158,7 @@
|
||||
SPF
|
||||
<a href="https://en.wikipedia.org/wiki/Sender_Policy_Framework"
|
||||
target="_blank"
|
||||
rel="noopener">(Wikipedia↗)</a>
|
||||
rel="noopener noreferrer">(Wikipedia↗)</a>
|
||||
is an email
|
||||
authentication method
|
||||
designed to detect forging sender addresses during the delivery of the email.
|
||||
@ -229,7 +229,7 @@
|
||||
DKIM
|
||||
<a href="https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail"
|
||||
target="_blank"
|
||||
rel="noopener">(Wikipedia↗)</a>
|
||||
rel="noopener noreferrer">(Wikipedia↗)</a>
|
||||
is an
|
||||
email
|
||||
authentication method
|
||||
@ -335,7 +335,7 @@
|
||||
DMARC
|
||||
<a href="https://en.wikipedia.org/wiki/DMARC"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
rel="noopener noreferrer">
|
||||
(Wikipedia↗)
|
||||
</a>
|
||||
is designed to protect the domain from unauthorized use, commonly known as email spoofing.
|
||||
|
@ -72,7 +72,7 @@ PGP Encryption
|
||||
</ul>
|
||||
<div class="small-text">
|
||||
More information on our
|
||||
<a href="https://simplelogin.io/pricing" target="_blank" rel="noopener">
|
||||
<a href="https://simplelogin.io/pricing" target="_blank" rel="noopener noreferrer">
|
||||
Pricing
|
||||
Page <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
@ -120,7 +120,7 @@ Upgrade your SimpleLogin account
|
||||
<div id="normal-upgrade" class="{% if proton_upgrade %} collapse{% endif %}">
|
||||
<div class="display-6 my-3">
|
||||
🔐 Secure payments by
|
||||
<a href="https://paddle.com" target="_blank" rel="noopener">
|
||||
<a href="https://paddle.com" target="_blank" rel="noopener noreferrer">
|
||||
Paddle <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -164,13 +164,13 @@ $4/month
|
||||
<hr />
|
||||
<i class="fa fa-bitcoin"></i>
|
||||
Payment via
|
||||
<a href="https://commerce.coinbase.com/?lang=en" target="_blank">
|
||||
<a href="https://commerce.coinbase.com/?lang=en" target="_blank" rel="noopener noreferrer">
|
||||
Coinbase Commerce<i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
<br />
|
||||
Currently Bitcoin, Bitcoin Cash, Dai, Ethereum, Litecoin and USD Coin are supported.
|
||||
<br />
|
||||
<a class="btn btn-outline-primary" href="{{ url_for('dashboard.coinbase_checkout_route') }}" target="_blank">
|
||||
<a class="btn btn-outline-primary" href="{{ url_for('dashboard.coinbase_checkout_route') }}" target="_blank" rel="noopener noreferrer">
|
||||
Yearly billing - Crypto
|
||||
<br />
|
||||
$30/year
|
||||
|
@ -17,7 +17,8 @@
|
||||
<div class="alert alert-info">
|
||||
This page shows all emails that are either refused by your mailbox (bounced) or detected as spams/phishing (quarantine) via our
|
||||
<a href="https://simplelogin.io/docs/getting-started/anti-phishing/"
|
||||
target="_blank">anti-phishing program ↗</a>
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">anti-phishing program ↗</a>
|
||||
<ul class="p-4 mb-0">
|
||||
<li>
|
||||
If the email is indeed spam, this means the alias is now in the hands of a spammer,
|
||||
@ -26,7 +27,8 @@
|
||||
<li>
|
||||
If the email isn't spam and your mailbox refuses the email, we recommend to create a <b>filter</b> to avoid your mailbox provider from blocking legitimate emails. Please refer to
|
||||
<a href="https://simplelogin.io/docs/getting-started/troubleshooting/#emails-end-up-in-spam"
|
||||
target="_blank">Setting up filter for SimpleLogin emails ↗</a>
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">Setting up filter for SimpleLogin emails ↗</a>
|
||||
</li>
|
||||
<li>
|
||||
If the email is flagged as spams/phishing, this means that the sender explicitly states their emails should respect
|
||||
|
@ -73,7 +73,8 @@
|
||||
Yearly plan subscribed with cryptocurrency which expires on
|
||||
{{ coinbase_sub.end_at.format("YYYY-MM-DD") }}.
|
||||
<a href="{{ url_for('dashboard.coinbase_checkout_route') }}"
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Extend Subscription <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -25,7 +25,7 @@
|
||||
This feature is only available on Premium plan.
|
||||
<a href="{{ url_for('dashboard.pricing') }}"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
rel="noopener noreferrer">
|
||||
Upgrade<i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -33,6 +33,7 @@
|
||||
</div>
|
||||
<a href="https://docs.simplelogin.io"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="btn btn-block btn-secondary mt-4">
|
||||
Documentation <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
|
@ -10,7 +10,9 @@
|
||||
<h4 class="alert-heading">Well done!</h4>
|
||||
<p>
|
||||
Please head to our
|
||||
<a href="https://docs.simplelogin.io" target="_blank" rel="noopener">
|
||||
<a href="https://docs.simplelogin.io"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
documentation <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
to see how to add SIWSL into your app.
|
||||
|
@ -49,6 +49,7 @@
|
||||
<a href="{{ url_for('developer.new_client') }}" class="btn btn-primary">New website</a>
|
||||
<a href="https://docs.simplelogin.io"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="ml-2 btn btn-secondary">
|
||||
Docs <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
|
@ -13,7 +13,9 @@
|
||||
|
||||
<div class="col-sm-4 col-xl-2">
|
||||
<div class="card">
|
||||
<a href="{{ client.home_url }}" target="_blank" rel="noopener">
|
||||
<a href="{{ client.home_url }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
<img class="card-img-top" src="{{ client.get_icon_url() }}">
|
||||
</a>
|
||||
<div class="card-body d-flex flex-column">
|
||||
|
@ -46,7 +46,7 @@ https://litmus.com/blog/a-guide-to-bulletproof-buttons-in-email-design -->
|
||||
<a href="{{ link }}"
|
||||
class="f-fallback button"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
style="color: #FFF;
|
||||
border-color: #3869d4;
|
||||
border-style: solid;
|
||||
|
@ -145,28 +145,28 @@
|
||||
<ul class="list-group list-group-transparent list-group-white list-group-flush list-group-borderless mb-0 footer-list-group">
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
href="https://chrome.google.com/webstore/detail/dphilobhebphkdjbpfohgikllaljmgbn">
|
||||
Chrome Extension
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
href="https://addons.mozilla.org/firefox/addon/simplelogin/">
|
||||
Firefox Add-on
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
href="https://microsoftedge.microsoft.com/addons/detail/simpleloginreceive-sen/diacfpipniklenphgljfkmhinphjlfff">
|
||||
Edge Add-on
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
href="https://apps.apple.com/app/id1494051017">
|
||||
Safari
|
||||
Extension
|
||||
@ -174,7 +174,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
href="https://apps.apple.com/app/id1494359858">
|
||||
iOS
|
||||
(App Store)
|
||||
@ -182,14 +182,14 @@
|
||||
</li>
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
href="https://play.google.com/store/apps/details?id=io.simplelogin.android">
|
||||
Android (Play Store)
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
rel="noopener"
|
||||
rel="noopener noreferrer"
|
||||
href="https://f-droid.org/en/packages/io.simplelogin.android.fdroid/">
|
||||
Android (F-Droid)
|
||||
</a>
|
||||
|
@ -75,14 +75,17 @@
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
|
||||
<div class="dropdown-menu dropdown-menu-left dropdown-menu-arrow">
|
||||
<div class="dropdown-item">
|
||||
<a href="https://simplelogin.io/docs/" target="_blank">
|
||||
<a href="https://simplelogin.io/docs/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Docs
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="dropdown-item">
|
||||
<a href="https://github.com/simple-login/app/discussions"
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Forum
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
@ -94,7 +97,9 @@
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="nav-item">
|
||||
<a href="https://simplelogin.io/docs/" target="_blank">
|
||||
<a href="https://simplelogin.io/docs/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Docs
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
@ -98,14 +98,17 @@
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
|
||||
<div class="dropdown-menu dropdown-menu-left dropdown-menu-arrow">
|
||||
<div class="dropdown-item">
|
||||
<a href="https://simplelogin.io/docs/" target="_blank">
|
||||
<a href="https://simplelogin.io/docs/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Docs
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="dropdown-item">
|
||||
<a href="https://github.com/simple-login/app/discussions"
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Forum
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
39
app/tests/example_emls/bad_base64format.eml
Normal file
39
app/tests/example_emls/bad_base64format.eml
Normal file
File diff suppressed because one or more lines are too long
@ -22,6 +22,7 @@ from app.models import (
|
||||
Contact,
|
||||
SentAlert,
|
||||
)
|
||||
from app.utils import random_string, canonicalize_email
|
||||
from email_handler import (
|
||||
get_mailbox_from_mail_from,
|
||||
should_ignore,
|
||||
@ -308,3 +309,78 @@ def test_replace_contacts_and_user_in_reply_phase(flask_client):
|
||||
payload = sent_mails[0].msg.get_payload()[0].get_payload()
|
||||
assert payload.find("Contact is {}".format(contact_real_mail)) > -1
|
||||
assert payload.find("Other contact is {}".format(contact2_real_mail)) > -1
|
||||
|
||||
|
||||
@mail_sender.store_emails_test_decorator
|
||||
def test_send_email_from_non_canonical_address_on_reply(flask_client):
|
||||
email_address = f"{random_string(10)}.suf@gmail.com"
|
||||
user = create_new_user(email=canonicalize_email(email_address))
|
||||
alias = Alias.create_new_random(user)
|
||||
Session.commit()
|
||||
contact = Contact.create(
|
||||
user_id=user.id,
|
||||
alias_id=alias.id,
|
||||
website_email=random_email(),
|
||||
reply_email=f"{random_string(10)}@{EMAIL_DOMAIN}",
|
||||
commit=True,
|
||||
)
|
||||
envelope = Envelope()
|
||||
envelope.mail_from = email_address
|
||||
envelope.rcpt_tos = [contact.reply_email]
|
||||
msg = EmailMessage()
|
||||
msg[headers.TO] = contact.reply_email
|
||||
msg[headers.SUBJECT] = random_string()
|
||||
result = email_handler.handle(envelope, msg)
|
||||
assert result == status.E200
|
||||
sent_mails = mail_sender.get_stored_emails()
|
||||
assert len(sent_mails) == 1
|
||||
email_logs = EmailLog.filter_by(user_id=user.id).all()
|
||||
assert len(email_logs) == 1
|
||||
assert email_logs[0].alias_id == alias.id
|
||||
assert email_logs[0].mailbox_id == user.default_mailbox_id
|
||||
|
||||
|
||||
@mail_sender.store_emails_test_decorator
|
||||
def test_send_email_from_non_canonical_matches_already_existing_user(flask_client):
|
||||
email_address = f"{random_string(10)}.suf@gmail.com"
|
||||
create_new_user(email=canonicalize_email(email_address))
|
||||
user = create_new_user(email=email_address)
|
||||
alias = Alias.create_new_random(user)
|
||||
Session.commit()
|
||||
contact = Contact.create(
|
||||
user_id=user.id,
|
||||
alias_id=alias.id,
|
||||
website_email=random_email(),
|
||||
reply_email=f"{random_string(10)}@{EMAIL_DOMAIN}",
|
||||
commit=True,
|
||||
)
|
||||
envelope = Envelope()
|
||||
envelope.mail_from = email_address
|
||||
envelope.rcpt_tos = [contact.reply_email]
|
||||
msg = EmailMessage()
|
||||
msg[headers.TO] = contact.reply_email
|
||||
msg[headers.SUBJECT] = random_string()
|
||||
result = email_handler.handle(envelope, msg)
|
||||
assert result == status.E200
|
||||
sent_mails = mail_sender.get_stored_emails()
|
||||
assert len(sent_mails) == 1
|
||||
email_logs = EmailLog.filter_by(user_id=user.id).all()
|
||||
assert len(email_logs) == 1
|
||||
assert email_logs[0].alias_id == alias.id
|
||||
assert email_logs[0].mailbox_id == user.default_mailbox_id
|
||||
|
||||
|
||||
@mail_sender.store_emails_test_decorator
|
||||
def test_break_loop_alias_as_mailbox(flask_client):
|
||||
user = create_new_user()
|
||||
alias = Alias.create_new_random(user)
|
||||
user.default_mailbox.email = alias.email
|
||||
Session.commit()
|
||||
envelope = Envelope()
|
||||
envelope.mail_from = random_email()
|
||||
envelope.rcpt_tos = [alias.email]
|
||||
msg = EmailMessage()
|
||||
msg[headers.TO] = alias.email
|
||||
msg[headers.SUBJECT] = random_string()
|
||||
result = email_handler.handle(envelope, msg)
|
||||
assert result == status.E525
|
||||
|
@ -2,7 +2,8 @@ import email
|
||||
from app.email_utils import (
|
||||
copy,
|
||||
)
|
||||
from app.message_utils import message_to_bytes
|
||||
from app.message_utils import message_to_bytes, message_format_base64_parts
|
||||
from tests.utils import load_eml_file
|
||||
|
||||
|
||||
def test_copy():
|
||||
@ -33,3 +34,13 @@ def test_to_bytes():
|
||||
|
||||
msg = email.message_from_string("éèà€")
|
||||
assert message_to_bytes(msg).decode() == "\néèà€"
|
||||
|
||||
|
||||
def test_base64_line_breaks():
|
||||
msg = load_eml_file("bad_base64format.eml")
|
||||
msg = message_format_base64_parts(msg)
|
||||
for part in msg.walk():
|
||||
if part.get("content-transfer-encoding") == "base64":
|
||||
body = part.get_payload()
|
||||
for line in body.splitlines():
|
||||
assert len(line) <= 76
|
||||
|
@ -66,7 +66,7 @@ def canonicalize_email_cases():
|
||||
yield (f"a@{domain}", f"a@{domain}")
|
||||
yield (f"a.b@{domain}", f"ab@{domain}")
|
||||
yield (f"a.b+c@{domain}", f"ab@{domain}")
|
||||
yield (f"a.b+c@other.com", f"a.b+c@other.com")
|
||||
yield ("a.b+c@other.com", "a.b+c@other.com")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dirty,clean", canonicalize_email_cases())
|
||||
|
@ -17,7 +17,7 @@ def create_new_user(email: Optional[str] = None, name: Optional[str] = None) ->
|
||||
if not email:
|
||||
email = f"user_{random_token(10)}@mailbox.test"
|
||||
if not name:
|
||||
name = f"Test User"
|
||||
name = "Test User"
|
||||
# new user has a different email address
|
||||
user = User.create(
|
||||
email=email,
|
||||
|
Reference in New Issue
Block a user