Commit 84522ed18e40dc04bb1f8a58b3d1188ee62912e7
1 parent
94ed516b
Exists in
master
and in
5 other branches
create change_password
Showing
4 changed files
with
62 additions
and
2 deletions
Show diff stats
@@ -0,0 +1,57 @@ | @@ -0,0 +1,57 @@ | ||
1 | +{% extends 'users/profile.html' %} | ||
2 | + | ||
3 | +{% load static i18n %} | ||
4 | +{% load widget_tweaks %} | ||
5 | +{% load django_bootstrap_breadcrumbs %} | ||
6 | + | ||
7 | +{% block breadcrumbs %} | ||
8 | + | ||
9 | + {{ block.super }} | ||
10 | + {% breadcrumb 'Edit' 'users:update_profile' %} | ||
11 | + | ||
12 | +{% endblock %} | ||
13 | + | ||
14 | +{% block content %} | ||
15 | + {% if messages %} | ||
16 | + {% for message in messages %} | ||
17 | + <div class="alert alert-success alert-dismissible" role="alert"> | ||
18 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
19 | + <span aria-hidden="true">×</span> | ||
20 | + </button> | ||
21 | + <p>{{ message }}</p> | ||
22 | + </div> | ||
23 | + {% endfor %} | ||
24 | + {% endif %} | ||
25 | + <div class="row"> | ||
26 | + <div class="col-md-12"> | ||
27 | + <div class="well well-lg"> | ||
28 | + <form method="post" action="" enctype="multipart/form-data"> | ||
29 | + {% csrf_token %} | ||
30 | + <div class="form-group"> | ||
31 | + <label class="control-label" for="focusedInput1">{% trans 'Current Password' %}</label> | ||
32 | + <input type="password" class="form-control" id="inputPassword" placeholder="Password"> | ||
33 | + </div> | ||
34 | + <div class="form-group"> | ||
35 | + <label class="control-label" for="focusedInput1">{% trans 'New Password' %}</label> | ||
36 | + <input type="password" class="form-control" id="inputPassword" placeholder="Password"> | ||
37 | + </div> | ||
38 | + <div class="form-group"> | ||
39 | + <label class="control-label" for="focusedInput1">{% trans 'Confirmation' %}</label> | ||
40 | + <input type="password" class="form-control" id="inputPassword" placeholder="Password"> | ||
41 | + </div> | ||
42 | + <div class="row"> | ||
43 | + <div class="col-md-3 col-sm-2 col-xs-2"> | ||
44 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-block btn-success" /> | ||
45 | + </div> | ||
46 | + <div class="col-md-3 col-sm-2 col-xs-2"> | ||
47 | + <a href="{% url 'users:profile' %}" class="btn btn-raised btn-block btn-danger" >{% trans 'Cancel' %}</a> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | + </form> | ||
51 | + </div> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + | ||
55 | + | ||
56 | + <br clear="all" /> | ||
57 | +{% endblock %} |
users/templates/users/profile.html
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | <li><a href="{% url 'app:index' %}">{% trans 'Home page' %}</a></li> | 21 | <li><a href="{% url 'app:index' %}">{% trans 'Home page' %}</a></li> |
22 | <li><a href="{% url 'users:profile' %}">{% trans 'View Profile' %}</a></li> | 22 | <li><a href="{% url 'users:profile' %}">{% trans 'View Profile' %}</a></li> |
23 | <li><a href="{% url 'users:update_profile' %}">{% trans 'Edit Profile' %}</a></li> | 23 | <li><a href="{% url 'users:update_profile' %}">{% trans 'Edit Profile' %}</a></li> |
24 | - <li><a href="#">{% trans 'Change Password' %}</a></li> | 24 | + <li><a href="{% url 'users:change_password' %}">{% trans 'Change Password' %}</a></li> |
25 | <li><a href="#">{% trans 'Remove account' %}</a></li> | 25 | <li><a href="#">{% trans 'Remove account' %}</a></li> |
26 | </ul> | 26 | </ul> |
27 | </div> | 27 | </div> |
users/urls.py
@@ -11,5 +11,6 @@ urlpatterns = [ | @@ -11,5 +11,6 @@ urlpatterns = [ | ||
11 | url(r'^profile/$', views.Profile.as_view(), name='profile'), | 11 | url(r'^profile/$', views.Profile.as_view(), name='profile'), |
12 | # | 12 | # |
13 | url(r'^profile/update/$', views.UpdateProfile.as_view(), name='update_profile'), | 13 | url(r'^profile/update/$', views.UpdateProfile.as_view(), name='update_profile'), |
14 | - url(r'^profile/delete/$', views.DeleteUser.as_view(), name='delete_profile'), | 14 | + url(r'^profile/change_password/$', views.Change_password.as_view(), name='change_password'), |
15 | + url(r'^profile/delete/$', views.DeleteUser.as_view(), name='delete_profile'), | ||
15 | ] | 16 | ] |
users/views.py
@@ -102,6 +102,8 @@ def delete(request,username): | @@ -102,6 +102,8 @@ def delete(request,username): | ||
102 | return redirect('users:manage') | 102 | return redirect('users:manage') |
103 | 103 | ||
104 | 104 | ||
105 | +class Change_password(generic.TemplateView): | ||
106 | + template_name = 'users/change_password.html' | ||
105 | 107 | ||
106 | class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): | 108 | class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): |
107 | 109 |