We have email verification

This commit is contained in:
Thomas Forgione
2017-09-23 16:20:56 +00:00
parent fa105f855a
commit dae9643cd0
21 changed files with 446 additions and 59 deletions

View File

@@ -0,0 +1,24 @@
{% extends "pyade/base.html" %}
{% block content %}
{% if login_failed %}
<div class="alert">Username or password incorrect. Please try again.</div>
{% endif %}
<div class="row">
<div class="col"></div>
<div class="col">
<form method="POST" action="{% url "login_target" %}">
<div class="form-group">
<input type="text" class="form-control" name="username" placeholder="Username" autofocus>
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" placeholder="Password">
</div>
<div class="form-group">
<input class="btn btn-primary form-control" type="submit" value="Log in">
</div>
{% csrf_token %}
</form>
</div>
<div class="col"></div>
</div>
{% endblock %}

View File

@@ -1,4 +1,17 @@
extends ../../../templates/base.pug
block content
p Login
if loginFailed
.alert
| Username or password incorrect. Please try again.
.row
.col
.col
form(method="POST", action=getUrl("loginTarget"))
.form-group
input.form-control(type="text", name="username", placeholder="Username", autofocus)
.form-group
input.form-control(type="password", name="password", placeholder="Password")
.form-group
input.btn.btn-primary.form-control(type="submit", value="Log in")
.col

View File

@@ -0,0 +1,9 @@
{% extends "pyade/base.html" %}
{% block content %}
<h1>
A mail was sent to you.
</h1>
<p>
In this mail, you'll find a link to activate your account.
</p>
{% endblock %}

View File

@@ -0,0 +1,8 @@
extends ../../../templates/base.pug
block content
h1 A mail was sent to you
p.
In this mail, you'll find a link to activate your account.
p.
Please, don't forget that my server is cheap, so depending on your mail provider, my email might get thrown in the spam :'(

View File

@@ -0,0 +1,38 @@
extends ../../../templates/base.pug
block content
if registeringFailed
.alert There was an error.
.row
.col
.col
form(method="POST", action=getUrl("signupTarget"))
.form-group
input.form-control(type='text', name='username', placeholder='Username', autofocus='')
.form-group
input#email.form-control(type='email', name='email', placeholder='E-mail address')
.form-group
input#pass1.form-control(type='password', name='password', placeholder='Password')
.form-group
input#pass2.form-control(type='password', placeholder='Retype your password')
.form-group
input.btn.btn-primary.form-control(type='submit', value='Log in')
.col
block extrajs
script.
var mail = document.getElementById('email'),
pass = document.getElementById('pass1'),
pass2 = document.getElementById('pass2');
function validatePasswords() {
if (pass1.value === pass2.value) {
pass2.setCustomValidity('');
} else {
pass2.setCustomValidity("Passwords don't match");
}
}
pass1.addEventListener('change', validatePasswords);
pass2.addEventListener('keyup', validatePasswords);

View File

@@ -0,0 +1,50 @@
style.
.body {
width: 570px;
padding: 0px;
margin-right: auto;
margin-left: auto;
border: solid;
border-width: thin;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.header {
padding: 10px;
border-bottom: solid;
border-bottom-width: thin;
}
.footer {
font-size: 75%;
padding: 10px;
border-top: solid;
border-top-width: thin;
}
h1 {
text-align: center;
}
p {
padding: 10px;
margin: 0px;
}
.username {
font-style: italic;
}
.body
.header
h1 Welcome on ADEjs!
p.
Hello #{user.username}!
p.
You recently subscribed on ADEjs with the email <a href="mailto:#{user.email}">#{user.email}</a>.
p.
To finalize your subscription, please <a href="#{activationUrl}">click here to activate your account</a>.
.footer.
If you did not subscribe on PyADE with this email address, please ignore this e-mail.

View File

@@ -0,0 +1,10 @@
Hello #{user.username}, and welcome on ADEjs!
You recently subscribed on ADEjs with the email <a href="mailto:#{user.email}">#{user.email}</a>.
To finalize your subscription, please <a href="#{activationUrl}">click here to activate your account</a>.
See you later on ADEjs!
---
If you did not subscribe on ADEjs with this email address, please ignore this e-mail.