From 01abc48f6214bf07d44c3b2c0bc0d36d40cc5780 Mon Sep 17 00:00:00 2001 From: Son NK Date: Thu, 30 Jan 2020 13:54:33 +0700 Subject: [PATCH] add trial information into welcome email --- app/auth/views/activate.py | 2 +- app/auth/views/facebook.py | 2 +- app/auth/views/github.py | 2 +- app/auth/views/google.py | 2 +- app/email_utils.py | 10 +++++----- shell.py | 3 ++- templates/emails/welcome.html | 10 +++++++--- templates/emails/welcome.txt | 21 ++++++++++++++++----- templates/header.html | 2 +- 9 files changed, 35 insertions(+), 19 deletions(-) diff --git a/app/auth/views/activate.py b/app/auth/views/activate.py index d472bdbc..44a9bbd9 100644 --- a/app/auth/views/activate.py +++ b/app/auth/views/activate.py @@ -41,7 +41,7 @@ def activate(): user = activation_code.user user.activated = True login_user(user) - email_utils.send_welcome_email(user.email, user.name) + email_utils.send_welcome_email(user) # activation code is to be used only once ActivationCode.delete(activation_code.id) diff --git a/app/auth/views/facebook.py b/app/auth/views/facebook.py index ef545b89..3d590140 100644 --- a/app/auth/views/facebook.py +++ b/app/auth/views/facebook.py @@ -130,7 +130,7 @@ def facebook_callback(): db.session.commit() login_user(user) - email_utils.send_welcome_email(user.email, user.name) + email_utils.send_welcome_email(user) flash(f"Welcome to SimpleLogin {user.name}!", "success") diff --git a/app/auth/views/github.py b/app/auth/views/github.py index f4e002df..a0488a7f 100644 --- a/app/auth/views/github.py +++ b/app/auth/views/github.py @@ -101,7 +101,7 @@ def github_callback(): ) db.session.commit() login_user(user) - email_utils.send_welcome_email(user.email, user.name) + email_utils.send_welcome_email(user) flash(f"Welcome to SimpleLogin {user.name}!", "success") diff --git a/app/auth/views/google.py b/app/auth/views/google.py index 56c628c2..3538fed3 100644 --- a/app/auth/views/google.py +++ b/app/auth/views/google.py @@ -115,7 +115,7 @@ def google_callback(): db.session.commit() login_user(user) - email_utils.send_welcome_email(user.email, user.name) + email_utils.send_welcome_email(user) flash(f"Welcome to SimpleLogin {user.name}!", "success") diff --git a/app/email_utils.py b/app/email_utils.py index 90f1fc70..7de12ae0 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -29,12 +29,12 @@ def _render(template_name, **kwargs) -> str: return template.render(**kwargs) -def send_welcome_email(email, name): +def send_welcome_email(user): send_email( - email, - f"Welcome to SimpleLogin {name}!", - _render("welcome.txt", name=name), - _render("welcome.html", name=name), + user.email, + f"Welcome to SimpleLogin {user.name}", + _render("welcome.txt", name=user.name, user=user), + _render("welcome.html", name=user.name, user=user), ) diff --git a/shell.py b/shell.py index 3506bf3c..49d28955 100644 --- a/shell.py +++ b/shell.py @@ -36,6 +36,7 @@ app = create_app() with app.app_context(): # to test email template # with open("/tmp/email.html", "w") as f: - # f.write(_render("welcome.html", name="John Wick")) + # user = User.get(1) + # f.write(_render("welcome.html", user=user, name=user.name)) embed() diff --git a/templates/emails/welcome.html b/templates/emails/welcome.html index f2129955..96e31cf9 100644 --- a/templates/emails/welcome.html +++ b/templates/emails/welcome.html @@ -11,12 +11,16 @@ {{ render_text('To better secure your account, I recommend enabling Multi-Factor Authentication (MFA) on your Setting page.') }} - {{ render_text('If you use Chrome or Firefox, SimpleLogin extension could be handy to quickly create aliases. Chrome extension can be installed on Chrome Store and Firefox on Firefox Store.') }} + {{ render_text('SimpleLogin browser extension could be handy to quickly manage aliases. Chrome (or other Chromium-based browsers like Brave or Vivaldi) extension can be installed on Chrome Store, Firefox on Firefox Store and Safari on AppStore.') }} {{ render_text('If you have a domain, for example for your business or your project, you can import your domain into SimpleLogin -and create your business emails backed by your personal email. This is cheaper and more convenient than buying a GSuite account. By the way, all our business emails are actually aliases :).') }} +and create your business emails using email alias. This is cheaper and more convenient than buying a dedicated solution like GSuite. By the way, all our business emails are actually aliases.') }} - {{ render_text('Importing domain is only available for Premium plan though, shoot me an email by replying to this email if you need a trial period.') }} + {% if user.in_trial() %} + {{ render_text('You can use all premium features like custom domain or alias directory during the trial period. Your trial will end ' + user.trial_end.humanize() + ".") }} + {% endif %} + + {{ render_text('If there\'s anything that\'s bugging you, even the smallest of issues that could be done better, I want to hear about it - so hit the reply button.') }} {% endblock %} diff --git a/templates/emails/welcome.txt b/templates/emails/welcome.txt index eb8bbed2..19618028 100644 --- a/templates/emails/welcome.txt +++ b/templates/emails/welcome.txt @@ -5,16 +5,27 @@ My name is Son. I’m the founder of SimpleLogin and I wanted to be the first to To better secure your account, I recommend enabling Multi-Factor Authentication (MFA) on your setting page at https://app.simplelogin.io/dashboard/setting -If you use Chrome or Firefox, SimpleLogin extension could be quite handy to quickly create aliases. -You can install Chrome extension on +SimpleLogin browser extension could be handy to quickly manage aliases. + +Chrome (or other Chromium-based browsers like Brave or Vivaldi) extension can be installed on: https://chrome.google.com/webstore/detail/simplelogin-your-anti-spa/dphilobhebphkdjbpfohgikllaljmgbn -and Firefox on +Firefox on https://addons.mozilla.org/en-GB/firefox/addon/simplelogin/ +and Safari on +https://apps.apple.com/us/app/simplelogin/id1494051017?mt=12&fbclid=IwAR0M0nnEKgoieMkmx91TSXrtcScj7GouqRxGgXeJz2un_5ydhIKlbAI79Io + If you have a domain, for example for your business or your project, you can import your domain into SimpleLogin -and create your business emails backed by your personal email! By the way, all our business emails are actually aliases 🤫. -Importing domain is only available for Premium plan though, shoot me an email if you need a trial period. +and create your business emails backed by your personal email! By the way, all our business emails are actually aliases. + +{% if user.in_trial() %} +You can use all premium features like custom domain or alias directory during the trial period. +Your trial will end {{ user.trial_end.humanize() }}. +{% endif %} + +If there's anything that's bugging you, even the smallest of issues that could be done better, I want to hear about it - so hit the reply button. + Thanks. Son - SimpleLogin founder. diff --git a/templates/header.html b/templates/header.html index c1e3d471..ced588ad 100644 --- a/templates/header.html +++ b/templates/header.html @@ -26,7 +26,7 @@ {% if current_user.in_trial() %} - Trial ends in {{ current_user.trial_end|dt }} + Trial ends {{ current_user.trial_end|dt }} {% elif current_user.lifetime_or_active_subscription() %} Premium {% endif %}