Deprecate social login, prettify some pages

This commit is contained in:
Son NK 2020-04-27 23:08:21 +02:00
parent a069fe7b6a
commit 96366ddcfa
10 changed files with 161 additions and 193 deletions

View File

@ -11,4 +11,5 @@ from .views import (
facebook,
change_email,
mfa,
social,
)

View File

@ -5,26 +5,29 @@
{% endblock %}
{% block single_content %}
{% if error %}
<div class="text-danger text-center mb-4">{{ error }}</div>
{% endif %}
<div class="card">
<div class="card-body p-6">
{% if incorrect_code %}
<div class="text-danger text-center h4">
The link is incorrect. <br><br>
Please go to <a href="{{ url_for('dashboard.setting') }}"
class="btn btn-warning">settings</a>
page to re-send confirmation email.
</div>
{% endif %}
{% if incorrect_code %}
<div class="text-danger text-center h4">
The link is incorrect. <br><br>
</div>
<div class="text-center">
Please go to <a href="{{ url_for('dashboard.setting') }}">settings</a>
page to re-send confirmation email.
</div>
{% endif %}
{% if expired_code %}
<div class="text-danger text-center h4">
The link is already expired. <br><br>
Please go to <a href="{{ url_for('dashboard.setting') }}"
class="btn btn-warning">settings</a>
page to re-send confirmation email.
{% if expired_code %}
<div class="text-danger text-center h4">
The link is already expired. <br><br>
</div>
<div class="text-center">
Please go to <a href="{{ url_for('dashboard.setting') }}">settings</a>
page to re-send confirmation email.
</div>
{% endif %}
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -12,7 +12,7 @@
<form class="card" method="post">
{{ form.csrf_token }}
<div class="card-body p-6">
<div class="card-title text-center">Forgot password</div>
<div class="card-title">Forgot password</div>
<div class="form-group">
<label class="form-label">Email address</label>

View File

@ -1,102 +1,56 @@
{% extends "single.html" %}
{% block title %}
Login
{% endblock %}
{% block head %}
<style>
.col-login {
max-width: 48rem;
}
</style>
{% endblock %}
{% block single_content %}
<h1 class="h2 text-center">Welcome back!</h1>
<div class="row">
<div class="col-md-6">
{% if show_resend_activation %}
<div class="text-center text-muted small mb-4">
You haven't received the activation email?
<a href="{{ url_for('auth.resend_activation') }}">Resend</a>
</div>
{% endif %}
<div class="card">
<form method="post">
{{ form.csrf_token }}
<div class="card-body p-6">
<div class="form-group">
<label class="form-label">Email address</label>
{{ form.email(class="form-control", type="email") }}
{{ render_field_errors(form.email) }}
</div>
<div class="form-group">
<label class="form-label">
Password
</label>
{{ form.password(class="form-control", type="password") }}
{{ render_field_errors(form.password) }}
<div class="text-muted">
<a href="{{ url_for('auth.forgot_password') }}" class="small">
I forgot my password
</a>
</div>
</div>
<div class="form-footer">
<button type="submit" class="btn btn-primary btn-block">Log in</button>
</div>
<div class="text-center text-muted mt-2">
Don't have an account yet? <a href="{{ url_for('auth.register') }}">Sign up</a>
</div>
</div>
</form>
</div>
{% if show_resend_activation %}
<div class="text-center text-muted small mb-4">
You haven't received the activation email?
<a href="{{ url_for('auth.resend_activation') }}">Resend</a>
</div>
{% endif %}
<div class="col-md-6">
<div class="card">
<div class="card-body p-6">
<div class="card-title text-center">Or with social login
</div>
<form class="card" method="post">
{{ form.csrf_token }}
<div class="card-body p-6">
<div class="card-title">Welcome back!</div>
<div class="form-group">
<label class="form-label">Email address</label>
{{ form.email(class="form-control", type="email") }}
{{ render_field_errors(form.email) }}
</div>
<a href="{{ url_for('auth.github_login', next=next_url) }}"
class="btn btn-block btn-social btn-github">
<i class="fa fa-github"></i> Sign in with Github
</a>
<a href="{{ url_for('auth.google_login', next=next_url) }}"
class="btn btn-block btn-social btn-google">
<i class="fa fa-google"></i> Sign in with Google
</a>
<a href="{{ url_for('auth.facebook_login', next=next_url) }}"
class="btn btn-block btn-social btn-facebook">
<i class="fa fa-facebook"></i> Sign in with Facebook
<div class="form-group">
<label class="form-label">
Password
</label>
{{ form.password(class="form-control", type="password") }}
{{ render_field_errors(form.password) }}
<div class="text-muted">
<a href="{{ url_for('auth.forgot_password') }}" class="small">
I forgot my password
</a>
</div>
<div class="text-center p-3" style="font-size: 12px; font-weight: 300; margin: auto">
</div>
We do not use the Facebook/Google SDK to avoid their trackers. <br>
However when using a social login button, please keep in mind that this social network will <b>know</b> that
you are using SimpleLogin.
<span class="badge badge-warning">Warning</span>
</div>
<div class="form-footer">
<button type="submit" class="btn btn-primary btn-block">Log in</button>
</div>
</div>
</form>
<div class="text-center text-muted mt-2">
Don't have an account yet? <a href="{{ url_for('auth.register') }}">Sign up</a>
</div>
<div class="text-center text-muted mt-5">
<a href="{{ url_for('auth.social') }}">Social Login</a> is now deprecated
</div>
{% endblock %}

View File

@ -9,8 +9,8 @@
{% block single_content %}
<div class="bg-white p-6" style="margin: auto">
<div>
Your account is protected with multi-factor authentication (MFA). <br>
<div class="mb-2">
Your account is protected with multi-factor authentication (MFA). <br><br>
To continue with the sign-in you need to provide the access code from your authenticator.
</div>

View File

@ -4,98 +4,45 @@
Register
{% endblock %}
{% block head %}
<style>
.col-login {
max-width: 48rem;
}
</style>
{% endblock %}
{% block single_content %}
<h1 class="h3 text-center">Create your SimpleLogin account now</h1>
<form class="card" method="post">
{{ form.csrf_token }}
<div class="card-body p-6">
<div class="card-title">Create new account</div>
<div class="row">
<div class="col-md-6">
<div class="card">
<form method="post">
{{ form.csrf_token }}
<div class="card-body p-6">
<div class="form-group">
<label class="form-label">Email address</label>
{{ form.email(class="form-control", type="email") }}
{{ render_field_errors(form.email) }}
</div>
<div class="form-group">
<label class="form-label">Password</label>
{{ form.password(class="form-control", type="password") }}
{{ render_field_errors(form.password) }}
</div>
<!-- TODO: add terms
<div class="form-group">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input"/>
<span class="custom-control-label">Agree the <a href="terms.html">terms and policy</a></span>
</label>
</div>
-->
<small class="text-center mt-3">
By clicking Create Account, you agree to abide by
<a href="https://simplelogin.io/terms">SimpleLogin's Terms and Conditions.</a>
</small>
<div class="mt-2">
<button type="submit" class="btn btn-primary btn-block">Create Account</button>
</div>
</div>
</form>
<div class="text-center text-muted mb-6">
Already have account? <a href="{{ url_for('auth.login') }}">Sign in</a>
</div>
<div class="form-group">
<label class="form-label">Email address</label>
{{ form.email(class="form-control", type="email") }}
{{ render_field_errors(form.email) }}
</div>
<div class="form-group">
<label class="form-label">Password</label>
{{ form.password(class="form-control", type="password") }}
{{ render_field_errors(form.password) }}
</div>
</div>
<!-- TODO: add terms
<div class="form-group">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input"/>
<span class="custom-control-label">Agree the <a href="terms.html">terms and policy</a></span>
</label>
</div>
-->
<div class="col-md-6">
<div class="card">
<div class="card-body p-6">
<div class="card-title text-center">Or with social login</div>
<a href="{{ url_for('auth.github_login', next=next_url) }}"
class="btn btn-block btn-social btn-github">
<i class="fa fa-github"></i> Sign up with Github
</a>
<a href="{{ url_for('auth.google_login', next=next_url) }}"
class="btn btn-block btn-social btn-google">
<i class="fa fa-google"></i> Sign up with Google
</a>
<a href="{{ url_for('auth.facebook_login', next=next_url) }}"
class="btn btn-block btn-social btn-facebook">
<i class="fa fa-facebook"></i> Sign up with Facebook
</a>
</div>
<div class="text-center p-3" style="font-size: 12px; font-weight: 300; margin: auto">
We do not use the Facebook/Google SDK to avoid their trackers. <br>
However when using a social login button, please keep in mind that this social network will <b>know</b> that
you are using SimpleLogin.
<span class="badge badge-warning">Warning</span>
</div>
<small class="text-center mt-3">
By clicking Create Account, you agree to abide by
<a href="https://simplelogin.io/terms">SimpleLogin's Terms and Conditions.</a>
</small>
<div class="mt-2">
<button type="submit" class="btn btn-primary btn-block">Create Account</button>
</div>
</div>
</form>
<div class="text-center text-muted mb-6">
Already have account? <a href="{{ url_for('auth.login') }}">Sign in</a>
</div>
{% endblock %}

View File

@ -5,15 +5,18 @@
{% endblock %}
{% block single_content %}
<div class="text-center bg-white p-5" style="max-width: 50rem">
<h1>
An email to validate your email is on its way.
</h1>
<div class="card">
<div class="card-body p-6 text-center">
<h3>
Please check your inbox/spam folder.
</h3>
<h1 class="h4">
An email to validate your email is on its way.
</h1>
<p>
Please check your inbox/spam folder.
</p>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends "single.html" %}
{% block title %}
Social Login
{% endblock %}
{% block single_content %}
<div class="card">
<div class="card-body p-6">
<div class="card-title text-center">Social login
</div>
<a href="{{ url_for('auth.github_login', next=next_url) }}"
class="btn btn-block btn-social btn-github">
<i class="fa fa-github"></i> Sign in with Github
</a>
<a href="{{ url_for('auth.google_login', next=next_url) }}"
class="btn btn-block btn-social btn-google">
<i class="fa fa-google"></i> Sign in with Google
</a>
<a href="{{ url_for('auth.facebook_login', next=next_url) }}"
class="btn btn-block btn-social btn-facebook">
<i class="fa fa-facebook"></i> Sign in with Facebook
</a>
</div>
<div class="text-center p-3" style="font-size: 12px; font-weight: 300; margin: auto">
<span class="badge badge-warning">Warning</span>
Please note that social login is now <b>deprecated</b>. <br><br>
Though practical, these social providers do not respect your privacy and therefore we recommend using
email/password.
</div>
</div>
<div class="text-center text-muted mt-2">
<a href="{{ url_for('auth.register') }}">Sign up</a> / <a href="{{ url_for('auth.login') }}">Login</a>
</div>
{% endblock %}

14
app/auth/views/social.py Normal file
View File

@ -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")

View File

@ -4,10 +4,10 @@
<div class="page-single">
<div class="container">
<div class="row">
<div class="col mx-auto" style="max-width: 50rem">
<div class="col mx-auto" style="max-width: 24rem">
<div class="text-center mb-6">
<a href="https://simplelogin.io">
<img src="/static/logo.svg" style="background-color: transparent; height: 24px">
<img src="/static/logo.svg" style="background-color: transparent; height: 20px">
</a>
</div>