@@ -28,21 +28,36 @@ <h3 class="box-title">Users</h3>
28
28
< th width ="210px "> created at</ th >
29
29
< th width ="210px "> updated at</ th >
30
30
{% if CurrentUser.IsSuperuser %}
31
- < th width ="150px "> -</ th >
31
+ < th width ="250px "> -</ th >
32
32
{% endif %}
33
33
</ tr >
34
34
{% for user in users %}
35
35
< tr >
36
36
< td > {{ user.ID }}</ td >
37
- < td > {{ user.Name }}</ td >
37
+ < td > {{ user.Name }} {% if user.IsSuperuser %}(superuser){% endif %} </ td >
38
38
< td > {{ user.Login }}</ td >
39
39
< td > {{ user.Email }}</ td >
40
40
< td > {{ user.CreatedAt | time:"Mon, 02 Jan 2006 15:04:05 -0700" }}</ td >
41
41
< td > {{ user.UpdatedAt | time:"Mon, 02 Jan 2006 15:04:05 -0700" }}</ td >
42
42
{% if CurrentUser.IsSuperuser %}
43
43
< td >
44
- < a href ="# "> < i class ="fa fa-pencil-square-o " aria-hidden ="true "> </ i > edit</ a >
44
+ < a href ="# "
45
+ data-toggle ="modal "
46
+ data-target ="#updateUserForm "
47
+ data-action ="/users/update/{{ user.ID }}/ "
48
+ data-source ="/users/get/{{ user.ID }}/ "
49
+ > < i class ="fa fa-pencil-square-o " aria-hidden ="true "> </ i > edit</ a >
50
+
51
+ {% if user.ID != CurrentUser.ID %}
52
+ < a href ="# "
53
+ data-toggle ="modal "
54
+ data-target ="#resetPasswordForm "
55
+ data-action ="/password/reset/{{ user.ID }}/ "
56
+ > < i class ="fa fa-refresh " aria-hidden ="true "> </ i > reset password</ a >
57
+ {% endif %}
58
+ {% if !user.IsSuperuser %}
45
59
< a href ="# " data-toggle ="modal " data-target ="#confirmAction " data-action ="/users/delete/{{ user.ID }}/ "> < i class ="fa fa-trash " aria-hidden ="true "> </ i > delete</ a >
60
+ {% endif %}
46
61
</ td >
47
62
{% endif %}
48
63
</ tr >
@@ -52,12 +67,16 @@ <h3 class="box-title">Users</h3>
52
67
</ div >
53
68
< div class ="box-footer clearfix ">
54
69
{% if CurrentUser.IsSuperuser %}
55
- < button type ="submit " data-toggle ="modal " data-target ="#addUser " class ="btn btn-primary "> Add user</ button >
70
+ < button type ="submit "
71
+ data-toggle ="modal "
72
+ data-target ="#addUserForm "
73
+ class ="btn btn-primary "> Add user</ button >
56
74
{% endif %} {% endverbatim %} {% include "../internal/pagination.html" %}
57
75
</ div >
58
76
{% verbatim %} {% if CurrentUser.IsSuperuser %}
59
- < div class ="modal fade " id ="addUser " tabindex ="-1 " role ="dialog ">
77
+ < div class ="modal fade " id ="addUserForm " tabindex ="-1 " role ="dialog ">
60
78
< div class ="modal-dialog " role ="document ">
79
+ < form method ="post " action ="/users/add/ ">
61
80
< div class ="modal-content ">
62
81
< div class ="modal-header ">
63
82
< button type ="button " class ="close " data-dismiss ="modal " aria-label ="Close "> < span aria-hidden ="true "> ×</ span > </ button >
@@ -66,29 +85,95 @@ <h4 class="modal-title">Add user</h4>
66
85
< div class ="modal-body ">
67
86
< div class ="form-group ">
68
87
< label for ="message-text " class ="control-label "> user name:</ label >
69
- < input type ="text " name ="user_name " class ="form-control ">
88
+ < input type ="text " name ="name " class ="form-control " data-title =" Enter user name " required >
70
89
</ div >
71
90
< div class ="form-group ">
72
91
< label for ="message-text " class ="control-label "> email:</ label >
73
- < input type ="email " name ="email " class ="form-control ">
92
+ < input type ="email " name ="email " class ="form-control " data-title =" Enter email " required >
74
93
</ div >
75
94
< div class ="form-group ">
76
95
< label for ="message-text " class ="control-label "> login:</ label >
77
- < input type ="text " name ="login " class ="form-control ">
96
+ < input type ="text " name ="login " class ="form-control " data-title =" Enter login " required >
78
97
</ div >
79
98
< div class ="form-group ">
80
99
< label for ="message-text " class ="control-label "> password:</ label >
81
- < input type ="password " name ="password " class ="form-control " id ="password ">
100
+ < input type ="password " name ="password " class ="form-control " id ="password " data-title =" Enter password " required >
82
101
</ div >
83
102
< div class ="form-group ">
84
103
< label > < input type ="checkbox " name ="is_superuser "> superuser</ label >
85
104
</ div >
86
105
</ div >
87
106
< div class ="modal-footer ">
88
107
< button type ="button " class ="btn btn-default " data-dismiss ="modal "> close</ button >
89
- < button type ="submit " class ="btn btn-primary "> add </ button >
108
+ < button type ="submit " class ="btn btn-primary "> submit </ button >
90
109
</ div >
91
110
</ div >
111
+ </ form >
112
+ </ div >
113
+ </ div >
114
+
115
+
116
+ < div class ="modal fade " id ="updateUserForm " tabindex ="-1 " role ="dialog ">
117
+ < div class ="modal-dialog " role ="document ">
118
+ < form method ="post " action ="">
119
+ < div class ="modal-content ">
120
+ < div class ="modal-header ">
121
+ < button type ="button " class ="close " data-dismiss ="modal " aria-label ="Close "> < span aria-hidden ="true "> ×</ span > </ button >
122
+ < h4 class ="modal-title "> Edit user</ h4 >
123
+ </ div >
124
+ < div class ="modal-body ">
125
+ < div class ="form-group ">
126
+ < label for ="message-text " class ="control-label "> user name:</ label >
127
+ < input type ="text " name ="name " id ="user_name " class ="form-control " data-title ="Enter user name " required >
128
+ </ div >
129
+ < div class ="form-group ">
130
+ < label for ="message-text " class ="control-label "> email:</ label >
131
+ < input type ="email " name ="email " id ="user_email " class ="form-control " data-title ="Enter email " required >
132
+ </ div >
133
+ < div class ="form-group ">
134
+ < label > < input type ="checkbox " id ="is_superuser " name ="is_superuser "> superuser</ label >
135
+ </ div >
136
+ </ div >
137
+ < div class ="modal-footer ">
138
+ < button type ="button " class ="btn btn-default " data-dismiss ="modal "> close</ button >
139
+ < button type ="submit " class ="btn btn-primary "> submit</ button >
140
+ </ div >
141
+ </ div >
142
+ </ form >
143
+ </ div >
144
+ </ div >
145
+
146
+
147
+ < div class ="modal fade " id ="resetPasswordForm " tabindex ="-1 " role ="dialog ">
148
+ < div class ="modal-dialog " role ="document ">
149
+ < form method ="post " action ="">
150
+ < div class ="modal-content ">
151
+ < div class ="modal-header ">
152
+ < button type ="button " class ="close " data-dismiss ="modal " aria-label ="Close "> < span aria-hidden ="true "> ×</ span > </ button >
153
+ < h4 class ="modal-title "> Reset password</ h4 >
154
+ </ div >
155
+ < div class ="modal-body ">
156
+
157
+
158
+
159
+ < div class ="form-group ">
160
+ < label for ="message-text " class ="control-label "> new password:</ label >
161
+ < input type ="password " name ="new_password " class ="form-control " data-title ="Enter password " required >
162
+ </ div >
163
+
164
+
165
+
166
+ < div class ="form-group ">
167
+ < label for ="message-text " class ="control-label "> confirm password:</ label >
168
+ < input type ="password " name ="confirm_password " class ="form-control " data-title ="Enter password " required >
169
+ </ div >
170
+ </ div >
171
+ < div class ="modal-footer ">
172
+ < button type ="button " class ="btn btn-default " data-dismiss ="modal "> close</ button >
173
+ < button type ="submit " class ="btn btn-primary "> submit</ button >
174
+ </ div >
175
+ </ div >
176
+ </ form >
92
177
</ div >
93
178
</ div >
94
179
{% endif %} {% endverbatim %}
0 commit comments