Commit ca5708cf01c7e840d3621715dd2df8fda8c26676
Committed by
Sergio Oliveira
1 parent
45a876ea
Exists in
master
and in
13 other branches
Custom Password Reset templates
Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com>
Showing
10 changed files
with
232 additions
and
68 deletions
Show diff stats
colab/accounts/urls.py
@@ -10,24 +10,23 @@ from django.contrib.auth import views as auth_views | @@ -10,24 +10,23 @@ from django.contrib.auth import views as auth_views | ||
10 | urlpatterns = patterns('', | 10 | urlpatterns = patterns('', |
11 | url(r'^register/$', 'colab.accounts.views.signup', name='signup'), | 11 | url(r'^register/$', 'colab.accounts.views.signup', name='signup'), |
12 | 12 | ||
13 | - url(r'^password-reset-done/?$', | ||
14 | - 'django.contrib.auth.views.password_reset_done', | 13 | + url(r'^password-reset-done/?$', 'accounts.views.password_reset_done_custom', |
15 | name="password_reset_done"), | 14 | name="password_reset_done"), |
16 | 15 | ||
17 | - url(r'^password-reset-complete/$', | ||
18 | - 'django.contrib.auth.views.password_reset_complete', | 16 | + url(r'^password-reset-complete/$', 'accounts.views.password_reset_complete_custom', |
19 | name="password_reset_complete"), | 17 | name="password_reset_complete"), |
20 | 18 | ||
21 | url(r'^password-reset-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', | 19 | url(r'^password-reset-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', |
22 | - 'django.contrib.auth.views.password_reset_confirm', | 20 | + auth_views.password_reset_confirm, |
21 | + {'template_name':'registration/password_reset_confirm_custom.html'}, | ||
23 | name="password_reset_confirm"), | 22 | name="password_reset_confirm"), |
24 | 23 | ||
25 | - url(r'^password-reset/?$', | ||
26 | - 'django.contrib.auth.views.password_reset', name="password_reset"), | 24 | + url(r'^password-reset/?$', auth_views.password_reset, |
25 | + {'template_name':'registration/password_reset_form_custom.html'}, | ||
26 | + name="password_reset"), | ||
27 | 27 | ||
28 | - url(r'^change-password/?$', | ||
29 | - auth_views.password_change, | ||
30 | - {'template_name': 'registration/password_change.html'}, | 28 | + url(r'^change-password/?$',auth_views.password_change, |
29 | + {'template_name':'registration/password_change_form_custom.html'}, | ||
31 | name='password_change'), | 30 | name='password_change'), |
32 | 31 | ||
33 | url(r'^change-password-done/?$', | 32 | url(r'^change-password-done/?$', |
colab/accounts/views.py
@@ -277,8 +277,22 @@ class ChangeXMPPPasswordView(UpdateView): | @@ -277,8 +277,22 @@ class ChangeXMPPPasswordView(UpdateView): | ||
277 | return response | 277 | return response |
278 | 278 | ||
279 | def password_changed(request): | 279 | def password_changed(request): |
280 | - messages.success(request, _('Your password has been updated!')) | 280 | + #FIXME: This message was not translated yet. |
281 | + messages.success(request, _('Your password was changed.')) | ||
281 | 282 | ||
282 | user = request.user | 283 | user = request.user |
283 | 284 | ||
284 | return redirect('user_profile_update', username=user.username) | 285 | return redirect('user_profile_update', username=user.username) |
286 | + | ||
287 | +def password_reset_done_custom(request): | ||
288 | + messages.success(request, _('We\'ve emailed you instructions for setting your password. You should be receiving them shortly.')) | ||
289 | + | ||
290 | + return redirect('home') | ||
291 | + | ||
292 | +def password_reset_complete_custom(request): | ||
293 | + #FIXME: This message was not translated yet. | ||
294 | + messages.success(request, _('Your password has been set. You may go ahead and log in now.')) | ||
295 | + | ||
296 | + return redirect('home') | ||
297 | + | ||
298 | + |
src/accounts/templates/registration/login.html
src/accounts/templates/registration/password_change.html
@@ -1,56 +0,0 @@ | @@ -1,56 +0,0 @@ | ||
1 | -{% extends "base.html" %} | ||
2 | -{% load i18n %} | ||
3 | -{% block main-content %} | ||
4 | - | ||
5 | -<div class="row"> | ||
6 | - {% if form.errors %} | ||
7 | - <div class="alert alert-danger"> | ||
8 | - <b> | ||
9 | - {% if form.errors.items|length == 1 %}{% trans "Please correct the error below and try again." %}{% else %}{% trans "Please correct the errors below and try again." %}{% endif %} | ||
10 | - </b> | ||
11 | - </div> | ||
12 | - {% endif %} | ||
13 | -</div> | ||
14 | - | ||
15 | -<br> | ||
16 | -<form action="" method="post" role="form" class="form-horizontal signup"> | ||
17 | - {% csrf_token %} | ||
18 | - | ||
19 | - <div class="row"> | ||
20 | - <div class="col-md-4 col-md-offset-4 col-lg-4 col-lg-offset-4 col-sm-8 col-sm-offset-2 col-xs-12"> | ||
21 | - <div class="panel panel-default"> | ||
22 | - <div class="panel-heading"><h3 class="panel-title">{% trans 'Change Password' %}</h3></div> | ||
23 | - | ||
24 | - <div class="panel-body"> | ||
25 | - <div class="form-group{% if form.old_password.errors %} alert alert-danger has-error{% endif %}"> | ||
26 | - {{ form.old_password.label_tag }} | ||
27 | - <input class="form-control" id="id_old_password" maxlength="254" name="old_password" type="password"> | ||
28 | - {{ form.old_password.errors }} | ||
29 | - </div> | ||
30 | - | ||
31 | - <div class="form-group{% if form.new_password1.errors %} alert alert-danger has-error{% endif %}"> | ||
32 | - {{ form.new_password1.label_tag }} | ||
33 | - <input class="form-control" id="id_new_password1" maxlength="254" name="new_password1" type="password"> | ||
34 | - {{ form.new_password1.errors }} | ||
35 | - </div> | ||
36 | - | ||
37 | - <div class="form-group{% if form.new_password2.errors %} alert alert-danger has-error{% endif %}"> | ||
38 | - {{ form.new_password2.label_tag }} | ||
39 | - <input class="form-control" id="id_new_password2" maxlength="254" name="new_password2" type="password"> | ||
40 | - {{ form.new_password2.errors }} | ||
41 | - </div> | ||
42 | - | ||
43 | - </div> | ||
44 | - </div> | ||
45 | - </div> | ||
46 | - </div> | ||
47 | - | ||
48 | - <div class="row"> | ||
49 | - <div class="submit"> | ||
50 | - <input type="submit" value="{% trans 'Change my password' %}" class="btn btn-primary btn-lg btn-block"> | ||
51 | - </div> | ||
52 | - <script type="text/javascript">document.getElementById("id_old_password").focus();</script> | ||
53 | - </div> | ||
54 | -</form> | ||
55 | - | ||
56 | -{% endblock %} |
src/accounts/templates/registration/password_change_form_custom.html
0 → 100644
@@ -0,0 +1,61 @@ | @@ -0,0 +1,61 @@ | ||
1 | +{% extends "base.html" %} | ||
2 | +{% load i18n %} | ||
3 | +{% block main-content %} | ||
4 | + | ||
5 | +<div class="row"> | ||
6 | + {% if form.errors %} | ||
7 | + <div class="alert alert-danger"> | ||
8 | + <b> | ||
9 | + {% if form.errors.items|length == 1 %} | ||
10 | + <!-- FIXME: This message was not translated yet --> | ||
11 | + {% trans "Please correct the error below and try again." %} | ||
12 | + {% else %} | ||
13 | + {% trans "Please correct the errors below and try again." %} | ||
14 | + {% endif %} | ||
15 | + </b> | ||
16 | + </div> | ||
17 | + {% endif %} | ||
18 | +</div> | ||
19 | + | ||
20 | +<br> | ||
21 | +<form action="" method="post" role="form" class="form-horizontal signup"> | ||
22 | + {% csrf_token %} | ||
23 | + | ||
24 | + <div class="row"> | ||
25 | + <div class="col-md-4 col-md-offset-4 col-lg-4 col-lg-offset-4 col-sm-8 col-sm-offset-2 col-xs-12"> | ||
26 | + <div class="panel panel-default"> | ||
27 | + <div class="panel-heading"><h3 class="panel-title">{% trans 'Change Password' %}</h3></div> | ||
28 | + | ||
29 | + <div class="panel-body"> | ||
30 | + <div class="form-group{% if form.old_password.errors %} alert alert-danger has-error{% endif %}"> | ||
31 | + {{ form.old_password.label_tag }} | ||
32 | + <input class="form-control" id="id_old_password" maxlength="254" name="old_password" type="password"> | ||
33 | + {{ form.old_password.errors }} | ||
34 | + </div> | ||
35 | + | ||
36 | + <div class="form-group{% if form.new_password1.errors %} alert alert-danger has-error{% endif %}"> | ||
37 | + {{ form.new_password1.label_tag }} | ||
38 | + <input class="form-control" id="id_new_password1" maxlength="254" name="new_password1" type="password"> | ||
39 | + {{ form.new_password1.errors }} | ||
40 | + </div> | ||
41 | + | ||
42 | + <div class="form-group{% if form.new_password2.errors %} alert alert-danger has-error{% endif %}"> | ||
43 | + {{ form.new_password2.label_tag }} | ||
44 | + <input class="form-control" id="id_new_password2" maxlength="254" name="new_password2" type="password"> | ||
45 | + {{ form.new_password2.errors }} | ||
46 | + </div> | ||
47 | + | ||
48 | + </div> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + </div> | ||
52 | + | ||
53 | + <div class="row"> | ||
54 | + <div class="submit"> | ||
55 | + <input type="submit" value="{% trans 'Change my password' %}" class="btn btn-primary btn-lg btn-block"> | ||
56 | + </div> | ||
57 | + <script type="text/javascript">document.getElementById("id_old_password").focus();</script> | ||
58 | + </div> | ||
59 | +</form> | ||
60 | + | ||
61 | +{% endblock %} |
src/accounts/templates/registration/password_reset_complete_custom.html
0 → 100644
src/accounts/templates/registration/password_reset_confirm_custom.html
0 → 100644
@@ -0,0 +1,64 @@ | @@ -0,0 +1,64 @@ | ||
1 | +{% extends "base.html" %} | ||
2 | +{% load i18n %} | ||
3 | +{% block title %}{% trans "Setting New password" %}{% endblock %} | ||
4 | +{% block main-content %} | ||
5 | + {% if validlink %} | ||
6 | + | ||
7 | + <div class="row"> | ||
8 | + {% if form.errors %} | ||
9 | + <div class="alert alert-danger"> | ||
10 | + <b> | ||
11 | + {% if form.errors.items|length == 1 %} | ||
12 | + {% trans "Please correct the error below and try again." %} | ||
13 | + {% else %} | ||
14 | + <!-- FIXME: This message was not translated yet --> | ||
15 | + {% trans "Please correct the errors below and try again." %} | ||
16 | + {% endif %} | ||
17 | + </b> | ||
18 | + </div> | ||
19 | + {% endif %} | ||
20 | + </div> | ||
21 | + | ||
22 | + <br> | ||
23 | + <form action="" method="post" role="form" class="form-horizontal signup"> | ||
24 | + {% csrf_token %} | ||
25 | + | ||
26 | + <div class="row"> | ||
27 | + <div class="col-md-4 col-md-offset-4 col-lg-4 col-lg-offset-4 col-sm-8 col-sm-offset-2 col-xs-12"> | ||
28 | + <div class="panel panel-default"> | ||
29 | + <div class="panel-heading"><h3 class="panel-title">{% trans 'Change Password' %}</h3></div> | ||
30 | + | ||
31 | + <div class="panel-body"> | ||
32 | + | ||
33 | + <div class="form-group{% if form.new_password1.errors %} alert alert-danger has-error{% endif %}"> | ||
34 | + {{ form.new_password1.label_tag }} | ||
35 | + <input class="form-control" id="id_new_password1" maxlength="254" name="new_password1" type="password"> | ||
36 | + {{ form.new_password1.errors }} | ||
37 | + </div> | ||
38 | + | ||
39 | + <div class="form-group{% if form.new_password2.errors %} alert alert-danger has-error{% endif %}"> | ||
40 | + {{ form.new_password2.label_tag }} | ||
41 | + <input class="form-control" id="id_new_password2" maxlength="254" name="new_password2" type="password"> | ||
42 | + {{ form.new_password2.errors }} | ||
43 | + </div> | ||
44 | + | ||
45 | + </div> | ||
46 | + </div> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + | ||
50 | + <div class="row"> | ||
51 | + <div class="submit"> | ||
52 | + <input type="submit" value="{% trans 'Change my password' %}" class="btn btn-primary btn-lg btn-block"> | ||
53 | + </div> | ||
54 | + <script type="text/javascript">document.getElementById("id_new_password1").focus();</script> | ||
55 | + </div> | ||
56 | + </form> | ||
57 | + {% else %} | ||
58 | + <h1>Password reset unsuccessful</h1> | ||
59 | + <p>The password reset link was invalid, <br /> | ||
60 | + possibly because it has already been used. <br /> | ||
61 | + Please request a new password reset.</p> | ||
62 | + {% endif %} | ||
63 | + | ||
64 | +{% endblock %} |
src/accounts/templates/registration/password_reset_done_custom.html
0 → 100644
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
1 | +{% extends "base.html" %} | ||
2 | + | ||
3 | +{% block title %}Password reset successful{% endblock %} | ||
4 | + | ||
5 | +{% block main-content %} | ||
6 | +<p>We've e-mailed you instructions for setting your password to the e-mail address you submitted.</p> | ||
7 | +<p>You should be receiving it shortly.</p> | ||
8 | +{% endblock %} |
src/accounts/templates/registration/password_reset_email_custom.html
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +{% autoescape off %} | ||
2 | +You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}. | ||
3 | + | ||
4 | +Please go to the following page and choose a new password: | ||
5 | +{% block reset_link %} | ||
6 | +{{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb64=uid, token=token %} | ||
7 | +{% endblock %} | ||
8 | + | ||
9 | +Your username, in case you've forgotten: {{ user.username }} | ||
10 | + | ||
11 | +Thanks for using our site! | ||
12 | + | ||
13 | +The {{ site_name }} team. | ||
14 | + | ||
15 | +{% endautoescape %} |
src/accounts/templates/registration/password_reset_form_custom.html
0 → 100644
@@ -0,0 +1,52 @@ | @@ -0,0 +1,52 @@ | ||
1 | +{% extends "base.html" %} | ||
2 | +{% load i18n %} | ||
3 | +{% block main-content %} | ||
4 | + | ||
5 | + | ||
6 | +<div class="row"> | ||
7 | + {% if form.errors %} | ||
8 | + <div class="alert alert-danger"> | ||
9 | + <b>{% trans "Please correct the errors below and try again" %}</b> | ||
10 | + </div> | ||
11 | + {% endif %} | ||
12 | +</div> | ||
13 | + | ||
14 | +<br> | ||
15 | +<form action="" method="post" role="form" class="form-horizontal signup"> | ||
16 | + {% csrf_token %} | ||
17 | + | ||
18 | + <div class="row"> | ||
19 | + <div class="col-md-4 col-md-offset-4 col-lg-6 col-lg-offset-3 col-sm-8 col-sm-offset-2 col-xs-12"> | ||
20 | + <div class="panel panel-default"> | ||
21 | + <div class="panel-heading"><h3 class="panel-title">{{ title }}</h3></div> | ||
22 | + <div class="panel-body"> | ||
23 | + <div class= >{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</div> | ||
24 | + <br> | ||
25 | + <div class="form-group{% if form.email.errors %} alert alert-danger has-error{% endif %}"> | ||
26 | + <label>{% trans 'Email address:' %}</label> | ||
27 | + <input class="form-control" id="id_email" maxlength="254" name="email" type="email"> | ||
28 | + {{ form.email.errors }} | ||
29 | + </div> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + </div> | ||
34 | + | ||
35 | + <div class="row"> | ||
36 | + <div class="submit"> | ||
37 | + <input class="btn btn-primary btn-lg btn-block" type="submit" value="Reset password" /></p> | ||
38 | + </div> | ||
39 | + </div> | ||
40 | + | ||
41 | +</form> | ||
42 | + | ||
43 | +{% endblock %} | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + |