remove the "Hi {name}" from email template

This commit is contained in:
Son NK 2021-01-11 10:22:39 +01:00
parent c9c2190874
commit ef7fae32b1
44 changed files with 104 additions and 126 deletions

View File

@ -318,7 +318,7 @@ def auth_google():
def auth_payload(user, device) -> dict:
ret = {"name": user.name, "email": user.email, "mfa_enabled": user.enable_otp}
ret = {"name": user.name or "", "email": user.email, "mfa_enabled": user.enable_otp}
# do not give api_key, user can only obtain api_key after OTP verification
if user.enable_otp:

View File

@ -55,7 +55,7 @@ def auth_mfa():
if not totp.verify(mfa_token):
return jsonify(error="Wrong TOTP Token"), 400
ret = {"name": user.name, "email": user.email}
ret = {"name": user.name or "", "email": user.email}
api_key = ApiKey.get_by(user_id=user.id, name=device)
if not api_key:

View File

@ -14,7 +14,7 @@ from app.utils import random_string
def user_to_dict(user: User) -> dict:
ret = {
"name": user.name,
"name": user.name or "",
"is_premium": user.is_premium(),
"email": user.email,
"in_trial": user.in_trial(),

View File

@ -59,7 +59,7 @@ def fido():
browser = MfaBrowser.get_by(token=request.cookies.get("mfa"))
if browser and not browser.is_expired() and browser.user_id == user.id:
login_user(user)
flash(f"Welcome back {user.name}!", "success")
flash(f"Welcome back!", "success")
# Redirect user to correct page
return redirect(next_url or url_for("dashboard.index"))
else:
@ -106,7 +106,7 @@ def fido():
del session[MFA_USER_ID]
login_user(user)
flash(f"Welcome back {user.name}!", "success")
flash(f"Welcome back!", "success")
# Redirect user to correct page
response = make_response(redirect(next_url or url_for("dashboard.index")))

View File

@ -52,7 +52,7 @@ def mfa():
browser = MfaBrowser.get_by(token=request.cookies.get("mfa"))
if browser and not browser.is_expired() and browser.user_id == user.id:
login_user(user)
flash(f"Welcome back {user.name}!", "success")
flash(f"Welcome back!", "success")
# Redirect user to correct page
return redirect(next_url or url_for("dashboard.index"))
else:
@ -70,7 +70,7 @@ def mfa():
db.session.commit()
login_user(user)
flash(f"Welcome back {user.name}!", "success")
flash(f"Welcome back!", "success")
# Redirect user to correct page
response = make_response(redirect(next_url or url_for("dashboard.index")))

View File

@ -50,7 +50,7 @@ def recovery_route():
del session[MFA_USER_ID]
login_user(user)
flash(f"Welcome back {user.name}!", "success")
flash(f"Welcome back!", "success")
recovery_code.used = True
recovery_code.used_at = arrow.now()

View File

@ -110,4 +110,4 @@ def send_activation_email(user, next_url):
LOG.d("redirect user to %s after activation", next_url)
activation_link = activation_link + "&next=" + encode_url(next_url)
email_utils.send_activation_email(user.email, user.name, activation_link)
email_utils.send_activation_email(user.email, activation_link)

View File

@ -331,7 +331,7 @@ def send_reset_password_email(user):
reset_password_link = f"{URL}/auth/reset_password?code={reset_password_code.code}"
email_utils.send_reset_password_email(user.email, user.name, reset_password_link)
email_utils.send_reset_password_email(user.email, reset_password_link)
def send_change_email_confirmation(user: User, email_change: EmailChange):
@ -341,7 +341,7 @@ def send_change_email_confirmation(user: User, email_change: EmailChange):
link = f"{URL}/auth/change_email?code={email_change.code}"
email_utils.send_change_email(email_change.new_email, user.email, user.name, link)
email_utils.send_change_email(email_change.new_email, user.email, link)
@dashboard_bp.route("/resend_email_change", methods=["GET", "POST"])

View File

@ -78,9 +78,9 @@ def send_welcome_email(user):
send_email(
to_email,
f"Welcome to SimpleLogin {user.name}",
render("com/welcome.txt", name=user.name, user=user, alias=alias),
render("com/welcome.html", name=user.name, user=user, alias=alias),
f"Welcome to SimpleLogin",
render("com/welcome.txt", user=user, alias=alias),
render("com/welcome.html", user=user, alias=alias),
unsubscribe_link,
via_email,
)
@ -89,62 +89,56 @@ def send_welcome_email(user):
def send_trial_end_soon_email(user):
send_email(
user.email,
f"Your trial will end soon {user.name}",
render("transactional/trial-end.txt", name=user.name, user=user),
render("transactional/trial-end.html", name=user.name, user=user),
f"Your trial will end soon",
render("transactional/trial-end.txt", user=user),
render("transactional/trial-end.html", user=user),
)
def send_activation_email(email, name, activation_link):
def send_activation_email(email, activation_link):
send_email(
email,
f"Just one more step to join SimpleLogin {name}",
f"Just one more step to join SimpleLogin",
render(
"transactional/activation.txt",
name=name,
activation_link=activation_link,
email=email,
),
render(
"transactional/activation.html",
name=name,
activation_link=activation_link,
email=email,
),
)
def send_reset_password_email(email, name, reset_password_link):
def send_reset_password_email(email, reset_password_link):
send_email(
email,
"Reset your password on SimpleLogin",
render(
"transactional/reset-password.txt",
name=name,
reset_password_link=reset_password_link,
),
render(
"transactional/reset-password.html",
name=name,
reset_password_link=reset_password_link,
),
)
def send_change_email(new_email, current_email, name, link):
def send_change_email(new_email, current_email, link):
send_email(
new_email,
"Confirm email update on SimpleLogin",
render(
"transactional/change-email.txt",
name=name,
link=link,
new_email=new_email,
current_email=current_email,
),
render(
"transactional/change-email.html",
name=name,
link=link,
new_email=new_email,
current_email=current_email,
@ -170,13 +164,11 @@ def send_cannot_create_directory_alias(user, alias_address, directory_name):
f"Alias {alias_address} cannot be created",
render(
"transactional/cannot-create-alias-directory.txt",
name=user.name,
alias=alias_address,
directory=directory_name,
),
render(
"transactional/cannot-create-alias-directory.html",
name=user.name,
alias=alias_address,
directory=directory_name,
),
@ -194,13 +186,11 @@ def send_cannot_create_directory_alias_disabled(user, alias_address, directory_n
f"Alias {alias_address} cannot be created",
render(
"transactional/cannot-create-alias-directory-disabled.txt",
name=user.name,
alias=alias_address,
directory=directory_name,
),
render(
"transactional/cannot-create-alias-directory-disabled.html",
name=user.name,
alias=alias_address,
directory=directory_name,
),
@ -216,13 +206,11 @@ def send_cannot_create_domain_alias(user, alias, domain):
f"Alias {alias} cannot be created",
render(
"transactional/cannot-create-alias-domain.txt",
name=user.name,
alias=alias,
domain=domain,
),
render(
"transactional/cannot-create-alias-domain.html",
name=user.name,
alias=alias,
domain=domain,
),

View File

@ -1182,9 +1182,9 @@ class ClientUser(db.Model, ModelMixin):
for scope in self.client.get_scopes():
if scope == Scope.NAME:
if self.name:
res[Scope.NAME.value] = self.name
res[Scope.NAME.value] = self.name or ""
else:
res[Scope.NAME.value] = self.user.name
res[Scope.NAME.value] = self.user.name or ""
elif scope == Scope.AVATAR_URL:
if self.user.profile_picture_id:
if self.default_avatar:

View File

@ -88,7 +88,7 @@ def notify_premium_end():
send_email(
user.email,
f"Your subscription will end soon {user.name}",
f"Your subscription will end soon",
render(
"transactional/subscription-end.txt",
user=user,
@ -115,16 +115,14 @@ def notify_manual_sub_end():
LOG.debug("Remind user %s that their manual sub is ending soon", user)
send_email(
user.email,
f"Your subscription will end soon {user.name}",
f"Your subscription will end soon",
render(
"transactional/manual-subscription-end.txt",
name=user.name,
user=user,
manual_sub=manual_sub,
),
render(
"transactional/manual-subscription-end.html",
name=user.name,
user=user,
manual_sub=manual_sub,
),
@ -498,13 +496,11 @@ def check_custom_domain():
render(
"transactional/custom-domain-dns-issue.txt",
custom_domain=custom_domain,
name=user.name or "",
domain_dns_url=domain_dns_url,
),
render(
"transactional/custom-domain-dns-issue.html",
custom_domain=custom_domain,
name=user.name or "",
domain_dns_url=domain_dns_url,
),
max_nb_alert=1,

View File

@ -447,14 +447,12 @@ def handle_email_sent_to_ourself(alias, mailbox, msg: Message, user):
f"Email sent to {alias.email} from its own mailbox {mailbox.email}",
render(
"transactional/cycle-email.txt",
name=user.name or "",
alias=alias,
mailbox=mailbox,
refused_email_url=refused_email_url,
),
render(
"transactional/cycle-email.html",
name=user.name or "",
alias=alias,
mailbox=mailbox,
refused_email_url=refused_email_url,
@ -569,14 +567,12 @@ def forward_email_to_mailbox(
f"Your mailbox {mailbox.email} and alias {alias.email} use the same domain",
render(
"transactional/mailbox-invalid.txt",
name=user.name or "",
mailbox=mailbox,
mailbox_url=mailbox_url,
alias=alias,
),
render(
"transactional/mailbox-invalid.html",
name=user.name or "",
mailbox=mailbox,
mailbox_url=mailbox_url,
alias=alias,
@ -1037,7 +1033,6 @@ def spf_pass(
f"SimpleLogin Alert: attempt to send emails from your alias {alias.email} from unknown IP Address",
render(
"transactional/spf-fail.txt",
name=user.name,
alias=alias.email,
ip=ip,
mailbox_url=URL + f"/dashboard/mailbox/{mailbox.id}#spf",
@ -1047,8 +1042,6 @@ def spf_pass(
),
render(
"transactional/spf-fail.html",
name=user.name,
alias=alias.email,
ip=ip,
mailbox_url=URL + f"/dashboard/mailbox/{mailbox.id}#spf",
to_email=contact_email,
@ -1094,7 +1087,6 @@ def handle_unknown_mailbox(
f"Attempt to use your alias {alias.email} from {envelope.mail_from}",
render(
"transactional/reply-must-use-personal-email.txt",
name=user.name,
alias=alias,
sender=envelope.mail_from,
authorize_address_link=authorize_address_link,
@ -1102,7 +1094,6 @@ def handle_unknown_mailbox(
),
render(
"transactional/reply-must-use-personal-email.html",
name=user.name,
alias=alias,
sender=envelope.mail_from,
authorize_address_link=authorize_address_link,
@ -1409,7 +1400,6 @@ def handle_spam(
f"Email from {alias.email} to {contact.website_email} is detected as spam",
render(
"transactional/spam-email-reply-phase.txt",
name=user.name,
alias=alias,
website_email=contact.website_email,
disable_alias_link=disable_alias_link,
@ -1417,7 +1407,6 @@ def handle_spam(
),
render(
"transactional/spam-email-reply-phase.html",
name=user.name,
alias=alias,
website_email=contact.website_email,
disable_alias_link=disable_alias_link,
@ -1440,7 +1429,6 @@ def handle_spam(
f"Email from {contact.website_email} to {alias.email} is detected as spam",
render(
"transactional/spam-email.txt",
name=user.name,
alias=alias,
website_email=contact.website_email,
disable_alias_link=disable_alias_link,
@ -1448,7 +1436,6 @@ def handle_spam(
),
render(
"transactional/spam-email.html",
name=user.name,
alias=alias,
website_email=contact.website_email,
disable_alias_link=disable_alias_link,

View File

@ -604,7 +604,6 @@ def setup_paddle_callback(app: Flask):
"SimpleLogin - what can we do to improve the product?",
render(
"transactional/subscription-cancel.txt",
name=user.name or "",
end_date=request.form.get("cancellation_effective_date"),
),
)

View File

@ -2,11 +2,7 @@
{% block greeting %}
<h1 style="margin-top: 0; color: #333333; font-size: 22px; font-weight: bold; text-align: left;" align="left">
{% if name %}
Welcome, {{ name }}!
{% else %}
Welcome!
{% endif %}
Welcome!
</h1>
{% endblock %}

View File

@ -1,4 +1,4 @@
Hi {{name}}
Hi!
{% if alias %}
This is the first email you receive via your first alias {{ alias }}.

View File

@ -1,7 +1,6 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{{ render_text("Thank you for choosing SimpleLogin.") }}
{{ render_text("To get started, please confirm that <b>" + email + "</b> is your email address by clicking on the button below within 1 hour.") }}
{{ render_button("Verify email", activation_link) }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
Thank you for choosing SimpleLogin.
To get started, please confirm that {{email}} is your email address using this link {{activation_link}} within 1 hour.

View File

@ -1,7 +1,11 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{% call text() %}
<h1>
Cannot create {{ alias }} on-the-fly
</h1>
{% endcall %}
{% call text() %}
An email has been sent to the alias <b>{{ alias }}</b> that would be created automatically as you own the directory <b>{{ directory }}</b>

View File

@ -1,5 +1,3 @@
Hi {{name}}
An email has been sent to the alias {{alias}} that would be created automatically as you own the directory {{directory}}.
As the directory has the on-the-fly alias creation disabled, the alias isn't created.

View File

@ -1,7 +1,12 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{% call text() %}
<h1>
Cannot create alias {{ alias }} on-the-fly
</h1>
{% endcall %}
{{ render_text("An email has been sent to the alias <b>" + alias + "</b> that would be created automatically as you own the directory <b>" + directory + "</b>.") }}
{{ render_text("However as your plan is no longer premium, this creation cannot happen.") }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
An email has been sent to the alias {{alias}} that would be created automatically as you own the directory {{directory}}. However as your plan is no longer premium, this creation cannot happen.
Please upgrade to premium plan in order to use this feature.

View File

@ -1,7 +1,12 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{% call text() %}
<h1>
Cannot create {{ alias }} on-the-fly
</h1>
{% endcall %}
{{ render_text("An email has been sent to the alias <b>" + alias + "</b> that would be created automatically as you own the domain <b>" + domain + "</b>.") }}
{{ render_text("However as your plan is no longer premium, this creation cannot happen.") }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
An email has been sent to the alias {{alias}} that would be created automatically as you own the domain {{domain}}. However as your plan is no longer premium, this creation cannot happen.
Please upgrade to premium plan in order to use this feature.

View File

@ -1,7 +1,6 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{{ render_text("You recently requested to change your email on SimpleLogin to <b>"+ new_email +"</b>.") }}
{{ render_text("Your current email is " + current_email + ".") }}
{{ render_text("Use the button below to confirm within the next 12 hours.") }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
You have asked to change your email to {{new_email}}.
Your current email is {{current_email}}.

View File

@ -1,10 +1,10 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{% call text() %}
We have detected that your domain <b>{{ custom_domain.domain }}</b> does not have the DNS set up correctly.
<h1>
<b>{{ custom_domain.domain }}</b> does not have the DNS set up correctly
</h1>
{% endcall %}
{% call text() %}

View File

@ -1,5 +1,3 @@
Hi {{name}}
We have detected that your domain {{ custom_domain.domain }} does not have the DNS set up correctly.
Please make sure to set up your domain following the instructions on your domain DNS page at:

View File

@ -2,12 +2,10 @@
{% block content %}
{% call text() %}
Hi {{ name }}
{% endcall %}
{% call text() %}
An email was sent to your alias <b>{{ alias.email }}</b> from its own mailbox
<b>{{ mailbox.email }}</b>.
<h1>
An email was sent to your alias <b>{{ alias.email }}</b> from its own mailbox
<b>{{ mailbox.email }}</b>.
</h1>
{% endcall %}
{% call text() %}

View File

@ -1,5 +1,3 @@
Hi {{name}}
An email was sent to your alias {{ alias.email }} from its own mailbox {{ mailbox.email }}.
SimpleLogin doesn't send this email back to your mailbox as it would be refused or hidden anyway by your email service.

View File

@ -1,6 +1,4 @@
Hi {{name}}
Your mailbox {{ mailbox.email }} and alias {{alias.email}} cannot use the same domain.
Your mailbox {{ mailbox.email }} and alias {{alias.email}} cannot have the same domain.
The alias domain should point to SimpleLogin servers so emails sent to it are forwarded by SimpleLogin.

View File

@ -1,5 +1,3 @@
Hi {{name}}
Your subscription will end on {{ manual_sub.end_at.format("YYYY-MM-DD") }}
Please contact us at hi@simplelogin.io to renew your subscription.

View File

@ -1,7 +1,11 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{% call text() %}
<h1>
An attempt to send an email from your alias <b>{{ alias.email }}</b> using <b>{{ sender }}</b> is blocked.
</h1>
{% endcall %}
{% call text() %}
As a measure to protect against <b>email spoofing</b>, we have blocked an attempt to send an email from your alias <b>{{ alias.email }}</b> using <b>{{ sender }}</b>.

View File

@ -1,5 +1,3 @@
Hi {{name}}
We have recorded an attempt to send an email from your alias {{ alias.email }} using {{ sender }}.
Please note that sending from this alias only works from alias's owning mailboxes, that are

View File

@ -1,7 +1,6 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{{ render_text("You recently requested to reset your password on SimpleLogin.") }}
{{ render_text("Use the button below to reset it. <b>This password reset is only valid for the next hour.</b>") }}
{{ render_button("Reset your password", reset_password_link) }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
To reset or change your password, please click on this link:
{{reset_password_link}}

View File

@ -1,16 +1,29 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{{ render_text("An email sent from your alias <b>" + alias.email + "</b> to <b>" + website_email + "</b> is detected as spam by our Spam Detection Engine (SpamAssassin).") }}
{% call text() %}
<h1>
An email sent from your alias {{ alias.email }} to {{ website_email }} is detected as spam.
</h1>
{% endcall %}
{{ render_text('In most of the cases, the email will be refused by your contact.') }}
{% call text() %}
An email sent from your alias {{ alias.email }} to {{ website_email }} is detected as spam by our Spam Detection Engine (SpamAssassin).
{% endcall %}
{% call text() %}
In most of the cases, the email will be refused by your contact.
{% endcall %}
{{ render_button("View the email", refused_email_url) }}
{{ render_text('The email is automatically deleted in 7 days.') }}
{% call text() %}
The email is automatically deleted in 7 days.
{% endcall %}
{{ render_text('Please let us know if you have any question by replying to this email.') }}
{% call text() %}
Please let us know if you have any question by replying to this email.
{% endcall %}
{{ render_text('Thanks, <br />SimpleLogin Team.') }}
{{ raw_url(disable_alias_link) }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
An email sent from your alias {{alias.email}} to {{website_email}} is detected as spam by our Spam Detection Engine (SpamAssassin).
In most of the cases, the email will be refused by your contact.

View File

@ -1,16 +1,29 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{{ render_text("An email sent to your alias <b>" + alias.email + "</b> from <b>" + website_email + "</b> is detected as spam by our Spam Detection Engine (SpamAssassin).") }}
{% call text() %}
<h1>
An email sent to your alias {{ alias.email }} from {{ website_email }} is detected as spam
</h1>
{% endcall %}
{{ render_text('In most of the cases, the email will be refused by your email provider.') }}
{% call text() %}
An email sent to your alias {{ alias.email }} from {{ website_email }} is detected as spam by our Spam Detection Engine (SpamAssassin).
{% endcall %}
{% call text() %}
In most of the cases, the email will be refused by your email provider.
{% endcall %}
{{ render_button("View the email", refused_email_url) }}
{{ render_text('The email is automatically deleted in 7 days.') }}
{% call text() %}
The email is automatically deleted in 7 days.
{% endcall %}
{{ render_text('Your alias <b>' + alias.email + '</b> is probably in the hands of a spammer now. In this case, you should disable or delete the alias immediately.') }}
{% call text() %}
Your alias {{ alias.email }} is probably in the hands of a spammer now. In this case, you should disable or delete the alias immediately.
{% endcall %}
{{ render_button("Disable alias", disable_alias_link) }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
An email sent to your alias {{alias.email}} from {{website_email}} is detected as spam by our Spam Detection Engine (SpamAssassin).
In most of the cases, the email will be refused by your email provider.

View File

@ -1,7 +1,11 @@
{% extends "base.html" %}
{% block content %}
{{ render_text("Hi " + name) }}
{% call text() %}
<h1>
Attempt to send an email from your alias <b>{{ alias }}</b> from an unknown IP address
</h1>
{% endcall %}
{% call text() %}
We have recorded an attempt to send the following email from your alias <b>{{ alias }}</b> from an unknown IP

View File

@ -1,5 +1,3 @@
Hi {{name}}
We have recorded an attempt to send the following email from your alias {{ alias }} from an unknown IP address {{ ip }}.
- From: {{alias}}

View File

@ -1,4 +1,4 @@
Hi {{name}}
Hi,
This is Son, SimpleLogin founder. I saw that you have canceled your subscription.

View File

@ -1,13 +1,12 @@
{% extends "base.html" %}
{% block content %}
{% if name %}
{{ render_text("Hi " + name + ",") }}
{% else %}
{{ render_text("Hi,") }}
{% endif %}
{{ render_text("Your trial will end " + user.trial_end.humanize() + ".") }}
{% call text() %}
<h1>
Your trial will end {{ user.trial_end.humanize() }}
</h1>
{% endcall %}
{{ render_text("When the trial ends:") }}

View File

@ -1,5 +1,3 @@
Hi {{name}}
Your trial will end {{ user.trial_end.humanize() }}.
When the trial ends: