From 96366ddcfa5f638a234f9e1071c53d2e4636d8b5 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Mon, 27 Apr 2020 23:08:21 +0200 Subject: [PATCH] Deprecate social login, prettify some pages --- app/auth/__init__.py | 1 + app/auth/templates/auth/change_email.html | 39 +++--- app/auth/templates/auth/forgot_password.html | 2 +- app/auth/templates/auth/login.html | 114 ++++++------------ app/auth/templates/auth/mfa.html | 4 +- app/auth/templates/auth/register.html | 113 +++++------------ .../auth/register_waiting_activation.html | 17 +-- app/auth/templates/auth/social.html | 46 +++++++ app/auth/views/social.py | 14 +++ templates/single.html | 4 +- 10 files changed, 161 insertions(+), 193 deletions(-) create mode 100644 app/auth/templates/auth/social.html create mode 100644 app/auth/views/social.py diff --git a/app/auth/__init__.py b/app/auth/__init__.py index 1932940a..322cbd81 100644 --- a/app/auth/__init__.py +++ b/app/auth/__init__.py @@ -11,4 +11,5 @@ from .views import ( facebook, change_email, mfa, + social, ) diff --git a/app/auth/templates/auth/change_email.html b/app/auth/templates/auth/change_email.html index d92b6066..681b6b13 100644 --- a/app/auth/templates/auth/change_email.html +++ b/app/auth/templates/auth/change_email.html @@ -5,26 +5,29 @@ {% endblock %} {% block single_content %} - {% if error %} -
{{ error }}
- {% endif %} +
+
- {% if incorrect_code %} -
- The link is incorrect.

- Please go to settings - page to re-send confirmation email. -
- {% endif %} + {% if incorrect_code %} +
+ The link is incorrect.

+
+
+ Please go to settings + page to re-send confirmation email. +
+ {% endif %} - {% if expired_code %} -
- The link is already expired.

- Please go to settings - page to re-send confirmation email. + {% if expired_code %} +
+ The link is already expired.

+
+
+ Please go to settings + page to re-send confirmation email. +
+ {% endif %}
- {% endif %} +
{% endblock %} \ No newline at end of file diff --git a/app/auth/templates/auth/forgot_password.html b/app/auth/templates/auth/forgot_password.html index db511821..82daacfc 100644 --- a/app/auth/templates/auth/forgot_password.html +++ b/app/auth/templates/auth/forgot_password.html @@ -12,7 +12,7 @@
{{ form.csrf_token }}
-
Forgot password
+
Forgot password
diff --git a/app/auth/templates/auth/login.html b/app/auth/templates/auth/login.html index 3bd8cb41..3d51062f 100644 --- a/app/auth/templates/auth/login.html +++ b/app/auth/templates/auth/login.html @@ -1,102 +1,56 @@ {% extends "single.html" %} - {% block title %} Login {% endblock %} - -{% block head %} - -{% endblock %} - {% block single_content %} -

Welcome back!

-
-
- {% if show_resend_activation %} -
- You haven't received the activation email? - Resend -
- {% endif %} -
- - {{ form.csrf_token }} -
-
- - {{ form.email(class="form-control", type="email") }} - {{ render_field_errors(form.email) }} -
- -
- - {{ form.password(class="form-control", type="password") }} - {{ render_field_errors(form.password) }} - -
- - - -
- Don't have an account yet? Sign up -
- -
- -
+ {% if show_resend_activation %} +
+ You haven't received the activation email? + Resend
+ {% endif %} -
-
-
-
Or with social login -
+
+ {{ form.csrf_token }} +
+
Welcome back!
+
+ + {{ form.email(class="form-control", type="email") }} + {{ render_field_errors(form.email) }} +
- - Sign in with Github - - - - Sign in with Google - - - - Sign in with Facebook +
+ + {{ form.password(class="form-control", type="password") }} + {{ render_field_errors(form.password) }} + -
+
- We do not use the Facebook/Google SDK to avoid their trackers.
- - However when using a social login button, please keep in mind that this social network will know that - you are using SimpleLogin. - - Warning - -
+
+
+ +
+ Don't have an account yet? Sign up +
+ +
+ Social Login is now deprecated
{% endblock %} \ No newline at end of file diff --git a/app/auth/templates/auth/mfa.html b/app/auth/templates/auth/mfa.html index 650d8dad..2bf91993 100644 --- a/app/auth/templates/auth/mfa.html +++ b/app/auth/templates/auth/mfa.html @@ -9,8 +9,8 @@ {% block single_content %}
-
- Your account is protected with multi-factor authentication (MFA).
+
+ Your account is protected with multi-factor authentication (MFA).

To continue with the sign-in you need to provide the access code from your authenticator.
diff --git a/app/auth/templates/auth/register.html b/app/auth/templates/auth/register.html index 62d9afbd..46a26fd1 100644 --- a/app/auth/templates/auth/register.html +++ b/app/auth/templates/auth/register.html @@ -4,98 +4,45 @@ Register {% endblock %} -{% block head %} - -{% endblock %} - - {% block single_content %} -

Create your SimpleLogin account now

+
+ {{ form.csrf_token }} +
+
Create new account
-
-
-
- - {{ form.csrf_token }} -
-
- - {{ form.email(class="form-control", type="email") }} - {{ render_field_errors(form.email) }} -
- -
- - {{ form.password(class="form-control", type="password") }} - {{ render_field_errors(form.password) }} -
- - - - - By clicking Create Account, you agree to abide by - SimpleLogin's Terms and Conditions. - - -
- -
-
- - -
- Already have account? Sign in -
+
+ + {{ form.email(class="form-control", type="email") }} + {{ render_field_errors(form.email) }}
+
+ + {{ form.password(class="form-control", type="password") }} + {{ render_field_errors(form.password) }} +
-
+ -
-
- -
- - We do not use the Facebook/Google SDK to avoid their trackers.
- - However when using a social login button, please keep in mind that this social network will know that - you are using SimpleLogin. - - Warning - -
+ + By clicking Create Account, you agree to abide by + SimpleLogin's Terms and Conditions. + +
+
+ +
+ Already have account? Sign in
{% endblock %} \ No newline at end of file diff --git a/app/auth/templates/auth/register_waiting_activation.html b/app/auth/templates/auth/register_waiting_activation.html index 4b823b5c..ef081caf 100644 --- a/app/auth/templates/auth/register_waiting_activation.html +++ b/app/auth/templates/auth/register_waiting_activation.html @@ -5,15 +5,18 @@ {% endblock %} {% block single_content %} -
-

- An email to validate your email is on its way. -

+
+
-

- Please check your inbox/spam folder. -

+

+ An email to validate your email is on its way. +

+

+ Please check your inbox/spam folder. +

+ +
{% endblock %} \ No newline at end of file diff --git a/app/auth/templates/auth/social.html b/app/auth/templates/auth/social.html new file mode 100644 index 00000000..c5ca016e --- /dev/null +++ b/app/auth/templates/auth/social.html @@ -0,0 +1,46 @@ +{% extends "single.html" %} + + +{% block title %} + Social Login +{% endblock %} + + +{% block single_content %} +
+ +
+ Warning + Please note that social login is now deprecated.

+ + Though practical, these social providers do not respect your privacy and therefore we recommend using + email/password. +
+
+ +
+ Sign up / Login +
+ + + + +{% endblock %} \ No newline at end of file diff --git a/app/auth/views/social.py b/app/auth/views/social.py new file mode 100644 index 00000000..9cec190e --- /dev/null +++ b/app/auth/views/social.py @@ -0,0 +1,14 @@ +from flask import render_template, redirect, url_for +from flask_login import current_user + +from app.auth.base import auth_bp +from app.log import LOG + + +@auth_bp.route("/social", methods=["GET", "POST"]) +def social(): + if current_user.is_authenticated: + LOG.d("user is already authenticated, redirect to dashboard") + return redirect(url_for("dashboard.index")) + + return render_template("auth/social.html") diff --git a/templates/single.html b/templates/single.html index be4e7869..9132c18e 100644 --- a/templates/single.html +++ b/templates/single.html @@ -4,10 +4,10 @@
-