Bladeren bron

Merge pull request #28 from simple-login/misc

Misc
Son Nguyen Kim 5 jaren geleden
bovenliggende
commit
22e0013d00

+ 0 - 6
app/auth/templates/auth/register.html

@@ -22,12 +22,6 @@
         <form method="post">
           {{ form.csrf_token }}
           <div class="card-body p-6">
-            <div class="form-group">
-              <label class="form-label">How should we call you?</label>
-              {{ form.name(class="form-control") }}
-              {{ render_field_errors(form.name) }}
-            </div>
-
             <div class="form-group">
               <label class="form-label">Email address</label>
               {{ form.email(class="form-control", type="email") }}

+ 1 - 4
app/auth/views/register.py

@@ -17,7 +17,6 @@ class RegisterForm(FlaskForm):
     password = StringField(
         "Password", validators=[validators.DataRequired(), validators.Length(min=8)]
     )
-    name = StringField("Name", validators=[validators.DataRequired()])
 
 
 @auth_bp.route("/register", methods=["GET", "POST"])
@@ -46,9 +45,7 @@ def register():
         else:
             LOG.debug("create user %s", form.email.data)
             user = User.create(
-                email=form.email.data.lower(),
-                name=form.name.data,
-                password=form.password.data,
+                email=form.email.data.lower(), name="", password=form.password.data,
             )
             db.session.commit()
 

+ 6 - 2
app/dashboard/templates/dashboard/alias_log.html

@@ -133,8 +133,12 @@
 
   <nav aria-label="Alias log navigation">
     <ul class="pagination">
-      <li class="page-item {% if page_id == 0 %}disabled{% endif %}"><a class="page-link" href="{{ url_for('dashboard.alias_log', alias=alias, page_id=page_id-1) }}">Previous</a></li>
-      <li class="page-item {% if last_page %}disabled{% endif %}"><a class="page-link" href="{{ url_for('dashboard.alias_log', alias=alias, page_id=page_id+1) }}">Next</a></li>
+      <li class="page-item {% if page_id == 0 %}disabled{% endif %}">
+        <a class="page-link" href="{{ url_for('dashboard.alias_log', alias_id=alias_id, page_id=page_id-1) }}">Previous</a>
+      </li>
+      <li class="page-item {% if last_page %}disabled{% endif %}">
+        <a class="page-link" href="{{ url_for('dashboard.alias_log', alias_id=alias_id, page_id=page_id+1) }}">Next</a>
+      </li>
     </ul>
   </nav>
 {% endblock %}

+ 1 - 1
app/dashboard/templates/dashboard/index.html

@@ -111,7 +111,7 @@
             <span class="alias-activity">{{ alias_info.nb_forward }}</span> forwards,
             <span class="alias-activity">{{ alias_info.nb_blocked }}</span> blocks,
             <span class="alias-activity">{{ alias_info.nb_reply }}</span> replies
-            <a href="{{ url_for('dashboard.alias_log', alias=gen_email.email) }}"
+            <a href="{{ url_for('dashboard.alias_log', alias_id=gen_email.id) }}"
                class="btn btn-sm btn-link">
               See All Activity &nbsp;→
             </a>

+ 6 - 4
app/dashboard/views/alias_log.py

@@ -22,11 +22,13 @@ class AliasLog:
             setattr(self, k, v)
 
 
-@dashboard_bp.route("/alias_log/<alias>", methods=["GET"], defaults={"page_id": 0})
-@dashboard_bp.route("/alias_log/<alias>/<int:page_id>")
+@dashboard_bp.route(
+    "/alias_log/<int:alias_id>", methods=["GET"], defaults={"page_id": 0}
+)
+@dashboard_bp.route("/alias_log/<int:alias_id>/<int:page_id>")
 @login_required
-def alias_log(alias, page_id):
-    gen_email = GenEmail.get_by(email=alias)
+def alias_log(alias_id, page_id):
+    gen_email = GenEmail.get(alias_id)
 
     # sanity check
     if not gen_email:

+ 6 - 6
app/email_utils.py

@@ -30,7 +30,7 @@ def _render(template_name, **kwargs) -> str:
 def send_welcome_email(email, name):
     send_email(
         email,
-        f"{name}, welcome to SimpleLogin!",
+        f"Welcome to SimpleLogin {name}!",
         _render("welcome.txt", name=name),
         _render("welcome.html", name=name),
     )
@@ -39,7 +39,7 @@ def send_welcome_email(email, name):
 def send_activation_email(email, name, activation_link):
     send_email(
         email,
-        f"{name}, just one more step to join SimpleLogin",
+        f"Just one more step to join SimpleLogin {name}",
         _render(
             "activation.txt", name=name, activation_link=activation_link, email=email
         ),
@@ -52,7 +52,7 @@ def send_activation_email(email, name, activation_link):
 def send_reset_password_email(email, name, reset_password_link):
     send_email(
         email,
-        f"{name}, reset your password on SimpleLogin",
+        f"Reset your password on SimpleLogin",
         _render(
             "reset-password.txt", name=name, reset_password_link=reset_password_link
         ),
@@ -65,7 +65,7 @@ def send_reset_password_email(email, name, reset_password_link):
 def send_change_email(new_email, current_email, name, link):
     send_email(
         new_email,
-        f"{name}, confirm email update on SimpleLogin",
+        f"Confirm email update on SimpleLogin",
         _render(
             "change-email.txt",
             name=name,
@@ -86,7 +86,7 @@ def send_change_email(new_email, current_email, name, link):
 def send_new_app_email(email, name):
     send_email(
         email,
-        f"{name}, any question/feedback for SimpleLogin?",
+        f"Any question/feedback for SimpleLogin {name}?",
         _render("new-app.txt", name=name),
         _render("new-app.html", name=name),
     )
@@ -95,7 +95,7 @@ def send_new_app_email(email, name):
 def send_test_email_alias(email, name):
     send_email(
         email,
-        f"{name}, this email is sent to {email}",
+        f"This email is sent to {email}",
         _render("test-email.txt", name=name, alias=email),
         _render("test-email.html", name=name, alias=email),
     )

+ 13 - 3
templates/emails/welcome.html

@@ -1,8 +1,18 @@
 {% extends "base.html" %}
 
 {% block content %}
-  {{ render_text("Welcome " + name + "  🎉!") }}
-  {{ render_text("I really appreciate you signing up for SimpleLogin, and I'm sure you'll love it when you see how *simple* it is to use.") }}
-  {{ render_text("We built SimpleLogin to help people protecting their online identity, and I hope that we can achieve that for you.") }}
+  {{ render_text("Hi " + name) }}
+
+  {{ render_text("My name is Son. I’m the founder of SimpleLogin and I wanted to be the first to welcome you on board.") }}
+
+  {{ render_text('To better secure your account, I recommend enabling Multi-Factor Authentication (MFA) on your <a href="https://app.simplelogin.io/dashboard/setting">Setting page</a>.') }}
+
+  {{ render_text('If you use Chrome or Firefox, SimpleLogin extension could be quite handy to quickly create aliases. Chrome extension can be installed on <a href="https://chrome.google.com/webstore/detail/simplelogin-your-anti-spa/dphilobhebphkdjbpfohgikllaljmgbn">Chrome Store</a> and Firefox on <a href="https://addons.mozilla.org/en-GB/firefox/addon/simplelogin/">Firefox Store</a>.') }}
+
+  {{ 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 :).') }}
+
+  {{ render_text('Importing domain is only available for Premium plan though, shoot me an email if you need a trial period.') }}
+
 {% endblock %}
 

+ 15 - 4
templates/emails/welcome.txt

@@ -1,9 +1,20 @@
-Welcome {{name}} 🎉!
+Hi {{name}}
 
-I really appreciate you signing up for SimpleLogin, and I'm sure you'll love it when you see how *simple* it is to use.
+My name is Son. I’m the founder of SimpleLogin and I wanted to be the first to welcome you on board.
 
-We built SimpleLogin to help people protecting their online identity, and I hope that we can achieve that for you.
+To better secure your account, I recommend enabling Multi-Factor Authentication (MFA) on your setting page at
+https://app.simplelogin.io/dashboard/setting
 
-Thanks.
+If you use Chrome or Firefox, SimpleLogin extension could be quite handy to quickly create aliases.
+You can install Chrome extension on
+https://chrome.google.com/webstore/detail/simplelogin-your-anti-spa/dphilobhebphkdjbpfohgikllaljmgbn
+
+and Firefox on
+https://addons.mozilla.org/en-GB/firefox/addon/simplelogin/
 
+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.
+
+Thanks.
 Son - SimpleLogin founder.