Merge pull request #144 from simple-login/clean-up-ui
Deprecate social login
This commit is contained in:
commit
04f1cd5f7b
|
@ -11,4 +11,5 @@ from .views import (
|
|||
facebook,
|
||||
change_email,
|
||||
mfa,
|
||||
social,
|
||||
)
|
||||
|
|
|
@ -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 %}
|
|
@ -12,12 +12,11 @@
|
|||
<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>
|
||||
{{ form.email(class="form-control", type="email",
|
||||
placeholder="The email address associated with your SimpleLogin account") }}
|
||||
{{ form.email(class="form-control", type="email") }}
|
||||
{{ render_field_errors(form.email) }}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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 %}
|
|
@ -1,28 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-single">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col mx-auto card p-7" style="max-width: 50rem">
|
||||
<div class="text-center mb-6">
|
||||
<a href="https://simplelogin.io">
|
||||
<img src="/static/logo.svg" style="background-color: transparent; height: 24px">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="text-center text-muted">
|
||||
You are logged out.
|
||||
|
||||
<a href="{{ url_for('auth.login') }}">Login</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block title %}
|
||||
Logout
|
||||
{% endblock %}
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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 %}
|
|
@ -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 %}
|
|
@ -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 %}
|
|
@ -1,4 +1,4 @@
|
|||
from flask import request, render_template, redirect, url_for
|
||||
from flask import request, render_template, redirect, url_for, flash
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, validators
|
||||
|
||||
|
@ -17,14 +17,15 @@ def forgot_password():
|
|||
|
||||
if form.validate_on_submit():
|
||||
email = form.email.data.strip().lower()
|
||||
flash(
|
||||
"If your email is correct, you are going to receive an email to reset your password",
|
||||
"success",
|
||||
)
|
||||
|
||||
user = User.get_by(email=email)
|
||||
|
||||
if not user:
|
||||
error = "No such user, are you sure the email is correct?"
|
||||
return render_template("auth/forgot_password.html", form=form, error=error)
|
||||
|
||||
send_reset_password_email(user)
|
||||
return redirect(url_for("auth.forgot_password"))
|
||||
if user:
|
||||
send_reset_password_email(user)
|
||||
return redirect(url_for("auth.forgot_password"))
|
||||
|
||||
return render_template("auth/forgot_password.html", form=form)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from flask import render_template
|
||||
from flask import redirect, url_for, flash
|
||||
from flask_login import logout_user
|
||||
|
||||
from app.auth.base import auth_bp
|
||||
|
@ -7,4 +7,5 @@ from app.auth.base import auth_bp
|
|||
@auth_bp.route("/logout")
|
||||
def logout():
|
||||
logout_user()
|
||||
return render_template("auth/logout.html")
|
||||
flash("You are logged out", "success")
|
||||
return redirect(url_for("auth.login"))
|
||||
|
|
|
@ -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")
|
|
@ -328,6 +328,11 @@ def can_be_used_as_personal_email(email: str) -> bool:
|
|||
|
||||
# check if email MX domain is disposable
|
||||
mx_domains = get_mx_domain_list(domain)
|
||||
|
||||
# if no MX record, email is not valid
|
||||
if not mx_domains:
|
||||
return False
|
||||
|
||||
for mx_domain in mx_domains:
|
||||
if is_disposable_domain(mx_domain):
|
||||
LOG.d("MX Domain %s %s is disposable", mx_domain, domain)
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue