From 36243cba87c45ca4e25e237869e3684859d63156 Mon Sep 17 00:00:00 2001 From: onlyphantom Date: Sun, 24 Mar 2019 12:26:58 +0700 Subject: [PATCH] asynchronous email #20 & better login page --- app/email.py | 8 +++- app/static/css/pedagogy.css | 18 ++++++++ app/templates/login.html | 83 ++++++++++++++++++++++++----------- app/templates/register.html | 86 +++++++++++++++++++++++++------------ 4 files changed, 141 insertions(+), 54 deletions(-) diff --git a/app/email.py b/app/email.py index 704c80f..d7557d4 100644 --- a/app/email.py +++ b/app/email.py @@ -1,12 +1,17 @@ from flask import render_template from flask_mail import Message +from threading import Thread from app import app, mail # mail = flask_mail.Mail(app) +def send_async_email(app, msg): + with app.app_context(): + mail.send(msg) + def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender=sender, recipients=recipients) msg.body = text_body msg.html = html_body - mail.send(msg) + Thread(target=send_async_email, args=(app, msg)).start() def send_pw_reset_email(user): token = user.get_reset_password_token() @@ -18,4 +23,3 @@ def send_pw_reset_email(user): html_body=render_template('email/reset_password.html', user=user, token=token)) - diff --git a/app/static/css/pedagogy.css b/app/static/css/pedagogy.css index 025180e..65e17b6 100644 --- a/app/static/css/pedagogy.css +++ b/app/static/css/pedagogy.css @@ -281,4 +281,22 @@ input[type=range]::-moz-range-thumb { textarea#comments { height: 120px; +} + +/* List items*/ + +dt { + color: #273f52; +} + +dd { + color: white; +} + +#submit { + background: rgb(2, 73, 109); + border-radius: 8%; + border: none; + padding: 1% 2.5%; + color: white; } \ No newline at end of file diff --git a/app/templates/login.html b/app/templates/login.html index 922777c..ab4bce2 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -2,32 +2,67 @@ {% block content %}
-

Sign In

-
- {{ form.hidden_tag() }} -

- {{ form.email.label }}
- {{ form.email(size=32) }} +

+

Sign In

+
+
+
+ + {{ form.hidden_tag() }} +

+ {{ form.email.label }}
+ {{ form.email(size=42) }} + + {% for error in form.email.errors %} + {{ error }} + {% endfor %} +

+

+ {{ form.password.label }}
+ {{ form.password(size=42) }} + + {% for error in form.password.errors %} + {{ error }} + {% endfor %} +

+

{{ form.remember_me() }} {{ form.remember_me.label() }}

+

{{ form.submit() }}

+ +

Forgot your password? + Reset password here +

+
+
+

Feedback-driven performance management

+

+ Join algoritma's production team (consultants / instructors) to gain full access to Pedagogy. +

+
Regional
+
Work with 50+ companies across SEA: Indonesia, Singapore, and Thailand. Broaden + your skill set and perspective by immersing in a culturally diverse team. +
- {% for error in form.email.errors %} - {{ error }} - {% endfor %} -

-

- {{ form.password.label }}
- {{ form.password(size=32) }} +

Develop
+
Through intensive training, exposure, and holistic training programs, continue to + hone and develop the necessary skill to be a highly effective public consultant and data professional. +
+ +
Freedom
+
Choose your own progression path, your growth + direction, your week-to-week activities and focus. Our environment doesn't just allow that. We + support it. +
+
+

+ + Got a feature request? Encountered a bug? Open an issue on the GitHub repo. + +
+
+ + + - {% for error in form.password.errors %} - {{ error }} - {% endfor %} -

-

{{ form.remember_me() }} {{ form.remember_me.label() }}

-

{{ form.submit() }}

- -

- Forgot your password? - Reset password here -

{% endblock %} diff --git a/app/templates/register.html b/app/templates/register.html index 68ba96f..7178862 100644 --- a/app/templates/register.html +++ b/app/templates/register.html @@ -1,36 +1,66 @@ {% extends "base.html" %} {% block content %} -
-

Register Form

-
- {{ form.hidden_tag() }} -

- {{ form.email.label }}
- {{ form.email(size=32) }} +

+
+

Account Registration

+
+
+
+ + {{ form.hidden_tag() }} +

+ {{ form.email.label }}
+ {{ form.email(size=32) }} + + {% for error in form.email.errors %} + {{ error }} + {% endfor %} +

+

+ {{ form.password.label }}
+ {{ form.password(size=32) }} + + {% for error in form.password.errors %} + {{ error }} + {% endfor %} +

+

+ {{ form.password2.label }}
+ {{ form.password2(size=32) }} + + {% for error in form.password2.errors %} + {{ error }} + {% endfor %} +

+

{{ form.submit() }}

+ +
+
+

Feedback-driven performance management

+

+ Join algoritma's production team (consultants / instructors) to gain full access to Pedagogy. +

+
Regional
+
Work with 50+ companies across SEA: Indonesia, Singapore, and Thailand. Broaden + your skill set and perspective by immersing in a culturally diverse team. +
- {% for error in form.email.errors %} - {{ error }} - {% endfor %} -

-

- {{ form.password.label }}
- {{ form.password(size=32) }} +

Develop
+
Through intensive training, exposure, and holistic training programs, continue to + hone and develop the necessary skill to be a highly effective public consultant and data professional. +
- {% for error in form.password.errors %} - {{ error }} - {% endfor %} -

-

- {{ form.password2.label }}
- {{ form.password2(size=32) }} - - {% for error in form.password2.errors %} - {{ error }} - {% endfor %} -

-

{{ form.submit() }}

- +
Freedom
+
Choose your own progression path, your growth + direction, your week-to-week activities and focus. Our environment doesn't just allow that. We + support it. +
+
+

+
+
+
{% endblock %}