We can now change password

Fixes #2
This commit is contained in:
Thomas Forgione
2017-09-29 14:35:13 +02:00
parent ab1ebdd5dd
commit e8f827e6a7
9 changed files with 194 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ block content
input.form-control(type="text", name="username", placeholder="Username", autofocus)
.form-group
input.form-control(type="password", name="password", placeholder="Password")
.form-group
a(href=getUrl('passwordForgotten')) Forgot your password ?
.form-group
input.btn.btn-primary.form-control(type="submit", value="Log in")
.col

View File

@@ -0,0 +1,12 @@
extends ../../../templates/base.pug
block content
.row
.col
.col
form(method="POST", action=getUrl("passwordForgottenTarget"))
.form-group
input.form-control(type="text", name="email", placeholder="Enter your email address", autofocus)
.form-group
input.btn.btn-primary.form-control(type="submit", value="Request a new password")
.col

View File

@@ -0,0 +1,32 @@
extends ../../../templates/base.pug
block content
.row
.col
.col
form(method="POST", action=getUrl("resetPasswordTarget"))
input(style="display:none;", type="text", name="activationKey", value=user.activationKey)
.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='Change your password')
.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 told us that you lost your password.
p.
To set a new password, please visit <a href="#{resetUrl}">visit this link</a>.
.footer.
If you did not subscribe on PyADE with this email address, please ignore this e-mail.

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 reset 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 :'(