Skip to content

Commit 88c72ee

Browse files
committed
Small hotfix on password reset URL generation
1 parent 781da27 commit 88c72ee

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### V1.3.1
2+
* Small Hot-fix on reset password url generation
3+
14
## V1.3.0
25
* #23 amélioration du filtre de recherche de lieu
36
* #22 ajout de la fonctionnalité : mot de passe oublié (Credits David W.)

src/mapif.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def password_reset():
195195

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

201201
error = False

src/static/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"MAPBOXTOKEN":"pk.eyJ1IjoibHRvdXphcmQiLCJhIjoiY2lvMGV5OTJhMDB2Y3dka2xrZHpycGlrZiJ9.70MUkG_bCx7MPyIOhwfcKA",
33
"SERVER_ADDR":"localhost:5000",
4-
"VERSION" : "1.3.0",
4+
"VERSION" : "1.3.1",
55
"DEBUG":true,
66
"PROTOCOL": "http"
77
}

src/templates/emails/email_layout_simple.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<center style="width:100%">
88
<table border="0" cellpadding="20" cellspacing="0" width="600" bgcolor="#F8F8F8">
99
<tr>
10-
<td style="color:#FFFFFF;background:#3F51B5 url('{{ url_for('static', filename='favicon.png') }}') no-repeat center;text-align:center;">
10+
<td style="color:#FFFFFF;background:#3F51B5 url('{{ url_for('static', filename='favicon.png', _external=True) }}') no-repeat center;text-align:center;">
1111
<h1 style="line-height:100%;margin-bottom:5px;">{% block header %}MapIf{% endblock %}</h1>
1212
{% block subheader %}<h2 style="font-size:23px;margin-bottom:10px;color:#BDBDBD;line-height:135%;">SubHeader</h2>{% endblock %}
1313
{% block header_introduction %}<div style="font-size:15px;margin-bottom:0;line-height:135%;">Quick introduction</div>{% endblock %}
@@ -18,7 +18,7 @@ <h1 style="line-height:100%;margin-bottom:5px;">{% block header %}MapIf{% endblo
1818
<tr>
1919
<td bgcolor="#E1E1E1">
2020
<div style="font-size:13px;color:#828282!important;text-align:center;line-height:120%;">
21-
<a href="mailto:[email protected]">Contact</a> - <a href="{{ url_for('root') }}">MapIf</a> - <a href="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/LoicTouzard/MapIf">MapIf sur Github</a>
21+
<a href="mailto:[email protected]">Contact</a> - <a href="{{ url_for('root', _external=True) }}">MapIf</a> - <a href="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/LoicTouzard/MapIf">MapIf sur Github</a>
2222
</div>
2323
</td>
2424
</tr>

src/templates/emails/password_reset_simple.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<tr>
88
<td>
99
<h3>Salut {{ firstname }},</h3>
10-
<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>
10+
<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>
1111
</td>
1212
</tr>
1313
{% endblock %}

src/utils/emails.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ def send_email(to, subject, template, template_params):
6161
else:
6262
logger.log_error(resp_json['error'])
6363

64-
def send_password_reset_mail(email, firstname, reset_link):
64+
def send_password_reset_mail(email, firstname, token):
6565
params = {
6666
'firstname': firstname,
67-
'reset_link': reset_link
67+
'token': token,
68+
'email': email
6869
}
6970
send_email(email, 'Mot de passe oublié', 'emails/password_reset_simple.html', params)
7071

0 commit comments

Comments
 (0)