Skip to content

Commit

Permalink
Small hotfix on password reset URL generation
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicTouzard committed Mar 27, 2017
1 parent 781da27 commit 88c72ee
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### V1.3.1
* Small Hot-fix on reset password url generation

## V1.3.0
* #23 amélioration du filtre de recherche de lieu
* #22 ajout de la fonctionnalité : mot de passe oublié (Credits David W.)
Expand Down
2 changes: 1 addition & 1 deletion src/mapif.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def password_reset():

reset_link = "{0}password-reset?token={1}&email={2}".format(request.url_root, token, email)
user = db.get_user_by_email(email)
emails.send_password_reset_mail(email, user.firstname, reset_link)
emails.send_password_reset_mail(email, user.firstname, token)
logger.mprint("Process finished sending mail to {0} with link '{1}'".format(email, reset_link))

error = False
Expand Down
2 changes: 1 addition & 1 deletion src/static/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"MAPBOXTOKEN":"pk.eyJ1IjoibHRvdXphcmQiLCJhIjoiY2lvMGV5OTJhMDB2Y3dka2xrZHpycGlrZiJ9.70MUkG_bCx7MPyIOhwfcKA",
"SERVER_ADDR":"localhost:5000",
"VERSION" : "1.3.0",
"VERSION" : "1.3.1",
"DEBUG":true,
"PROTOCOL": "http"
}
4 changes: 2 additions & 2 deletions src/templates/emails/email_layout_simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<center style="width:100%">
<table border="0" cellpadding="20" cellspacing="0" width="600" bgcolor="#F8F8F8">
<tr>
<td style="color:#FFFFFF;background:#3F51B5 url('{{ url_for('static', filename='favicon.png') }}') no-repeat center;text-align:center;">
<td style="color:#FFFFFF;background:#3F51B5 url('{{ url_for('static', filename='favicon.png', _external=True) }}') no-repeat center;text-align:center;">
<h1 style="line-height:100%;margin-bottom:5px;">{% block header %}MapIf{% endblock %}</h1>
{% block subheader %}<h2 style="font-size:23px;margin-bottom:10px;color:#BDBDBD;line-height:135%;">SubHeader</h2>{% endblock %}
{% block header_introduction %}<div style="font-size:15px;margin-bottom:0;line-height:135%;">Quick introduction</div>{% endblock %}
Expand All @@ -18,7 +18,7 @@ <h1 style="line-height:100%;margin-bottom:5px;">{% block header %}MapIf{% endblo
<tr>
<td bgcolor="#E1E1E1">
<div style="font-size:13px;color:#828282!important;text-align:center;line-height:120%;">
<a href="mailto:[email protected]">Contact</a> - <a href="{{ url_for('root') }}">MapIf</a> - <a href="https://github.com/LoicTouzard/MapIf">MapIf sur Github</a>
<a href="mailto:[email protected]">Contact</a> - <a href="{{ url_for('root', _external=True) }}">MapIf</a> - <a href="https://github.com/LoicTouzard/MapIf">MapIf sur Github</a>
</div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/emails/password_reset_simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<tr>
<td>
<h3>Salut {{ firstname }},</h3>
<div>Voici un <a href="{{ reset_link }}">petit lien</a> pour réinitialiser ton mot de passe.<br>Ce lien expirera dans 10 minutes et est à utilisation unique.<br>Si tu ne l'as pas demandé ton mot de passe reste inchangé et tu peux ignorer ce message.</div>
<div>Voici un <a href="{{ url_for('password_reset_page', token=token, email=email, _external=True) }}">petit lien</a> pour réinitialiser ton mot de passe.<br>Ce lien expirera dans 10 minutes et est à utilisation unique.<br>Si tu ne l'as pas demandé ton mot de passe reste inchangé et tu peux ignorer ce message.</div>
</td>
</tr>
{% endblock %}
5 changes: 3 additions & 2 deletions src/utils/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ def send_email(to, subject, template, template_params):
else:
logger.log_error(resp_json['error'])

def send_password_reset_mail(email, firstname, reset_link):
def send_password_reset_mail(email, firstname, token):
params = {
'firstname': firstname,
'reset_link': reset_link
'token': token,
'email': email
}
send_email(email, 'Mot de passe oublié', 'emails/password_reset_simple.html', params)

0 comments on commit 88c72ee

Please sign in to comment.