Skip to content
Permalink
Browse files

add “must change password”; prepare #33

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 22, 2015
1 parent e437ec2 commit 301993c15c0e8d00cac9704de9d181adb3a60bd8
@@ -90,6 +90,10 @@ table.users .uid {
text-align: center;
}

.perm-descr {
font-size: x-small;
}

/* login (copied from Bootstrap example) */

.form-signin {
@@ -41,57 +41,59 @@ $('#deleteModal').on('show.bs.modal', function (event) {

<table class="table table-hover users" style="table-layout: fixed;">
<thead><tr>
<th class="uid">#</th>
<th class="username">Username</th>
<th class="realname">Real name</th>
<th class="email">E-mail address</th>
<th class="is_admin">Admin</th>
<th class="actions">Actions</th>
<th class="uid">#</th>
<th class="username">Username</th>
<th class="realname">Real name</th>
<th class="email">E-mail address</th>
<th class="is_admin">Admin</th>
<th class="actions">Actions</th>
</tr></thead>
{% for uid, user in USERS %}
{% if user.active %}
<tr>
{% else %}
<tr class="danger inactive-user">
{% endif %}
<td class="uid">{{ uid }}</td>
<td class="username">{{ user.username }}</td>
<td class="realname">{{ user.realname }}</td>
<td class="email">{{ user.email }}</td>
<td class="actions">
{% if user.is_admin %}
<i class="fa fa-check"></i>
{% else %}
<i class="fa fa-times"></i>
{% endif %}
</td>
<td class="actions">
<form action="{{ url_for('acp_users_edit') }}" method="POST">{{ editform.csrf_token }}
<input type="hidden" name="uid" value="{{ uid }}">
<input type="hidden" name="action" value="edit">
<div class="btn-group" role="group">
{% if user.active %}
<button type="submit" class="btn btn-sm btn-info" title="Edit"><i class="fa fa-pencil fa-fw"></i> Edit</button>
{% if user.uid == current_user.uid %}
<button type="button" class="btn btn-sm btn-danger" title="Delete" disabled><i class="fa fa-trash fa-fw"></i> Delete</button>
{% else %}
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="del" title="Delete"><i class="fa fa-trash fa-fw"></i> Delete</button>
{% endif %}
{% else %}
<button type="button" class="btn btn-sm btn-info" title="Edit" disabled><i class="fa fa-pencil fa-fw"></i> Edit</button>
<button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="undel" title="Undelete"><i class="fa fa-trash-o fa-fw"></i> Undelete</button>
{% endif %}
</div>
</form>
<td class="uid">{{ uid }}</td>
<td class="username">{{ user.username }}</td>
<td class="realname">{{ user.realname }}</td>
<td class="email">{{ user.email }}</td>
<td class="actions">
{% if user.is_admin %}
<i class="fa fa-check"></i>
{% else %}
<i class="fa fa-times"></i>
{% endif %}
</td>
<td class="actions">
<form action="{{ url_for('acp_users_edit') }}" method="POST">{{ editform.csrf_token }}
<input type="hidden" name="uid" value="{{ uid }}">
<input type="hidden" name="action" value="edit">
<div class="btn-group" role="group">
{% if user.active %}
<button type="submit" class="btn btn-sm btn-info" title="Edit"><i class="fa fa-pencil fa-fw"></i> Edit</button>
{% if user.uid == current_user.uid %}
<button type="button" class="btn btn-sm btn-danger" title="Delete" disabled><i class="fa fa-trash fa-fw"></i> Delete</button>
{% else %}
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="del" title="Delete"><i class="fa fa-trash fa-fw"></i> Delete</button>
{% endif %}
{% else %}
<button type="button" class="btn btn-sm btn-info" title="Edit" disabled><i class="fa fa-pencil fa-fw"></i> Edit</button>
<button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#deleteModal" data-username="{{ user.username }}" data-uid="{{ uid }}" data-direction="undel" title="Undelete"><i class="fa fa-trash-o fa-fw"></i> Undelete</button>
{% endif %}
</div>
</form>
</tr>
{% endfor %}
<tr><form action="{{ url_for('acp_users_edit') }}" method="POST">{{ editform.csrf_token }}
<td></td>
<td><input name="username" placeholder="New user" class="form-control"></td>
<td><input name="action" value="new" type="hidden"></td>
<td></td>
<td></td>
<td><button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-plus-square fa-fw"></i> Create</button></td>
<td class="uid"><strong>Create:</strong></td>
<td colspan="4"><input name="username" placeholder="New user" class="form-control input-sm"></td>
<td><button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-plus-square fa-fw"></i> Create</button></td>
</form></tr>
<tr><form action="{{ url_for('acp_users_import') }}" method="POST" enctype="multipart/form-data">{{ importform.csrf_token }}
<td class="uid"><strong>Import:</strong></td>
<td colspan="4"><input name="tsv" type="file" required></td>
<td><button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-file-text-o fa-fw"></i> Import TSV</button></td>
</form></tr>
</table>

@@ -95,6 +95,15 @@
{% endif %}
> User is an administrator
</label></div>
<div class="checkbox"><label><input type="checkbox" name="must_change_password"
{% if user.must_change_password %}
checked
{% endif %}
{% if user.uid == current_user.uid %}
disabled
{% endif %}
> User must change password on next login
</label></div>
<div class="checkbox"><label><input type="checkbox" name="can_edit_all_posts"
{% if user.can_edit_all_posts %}
checked
@@ -2,7 +2,7 @@
{% extends 'base.tmpl' %}
{% block extra_js %}
<script>
var PERMISSIONS = {{ json.dumps(PERMISSIONS) }};
var PERMISSIONS = {{ json.dumps(PERMISSIONS_E) }};
var UIDS = {{ json.dumps(UIDS) }};
var current_uid = {{ current_user.uid }};
$(document).ready(function() {
@@ -54,35 +54,39 @@ $(document).ready(function() {
{% endif %}

<form action="{{ url_for('acp_users_permissions') }}" method="POST">
<table class="table table-hover users" style="table-layout: fixed;">
<table class="table table-hover users">
<thead><tr>
<th class="uid">#</th>
<th class="username">Username</th>
<th class="perm is_active">Active<br>
<th class="perm is_active"><div class="perm-descr">Active</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="is_active"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="is_active"><i class="fa fa-square-o fa-fw"></i></button>
</th>
<th class="perm is_admin">Admin<br>
<th class="perm is_admin"><div class="perm-descr">Admin</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="is_admin"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="is_admin"><i class="fa fa-square-o fa-fw"></i></button>
</th>
<th class="perm can_edit_all_posts">Can all posts<br>
<th class="perm must_change_password"><div class="perm-descr">Must change password</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="must_change_password"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="must_change_password"><i class="fa fa-square-o fa-fw"></i></button>
</th>
<th class="perm can_edit_all_posts"><div class="perm-descr">Can all posts</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="can_edit_all_posts"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="can_edit_all_posts"><i class="fa fa-square-o fa-fw"></i></button>
</th>
<th class="perm wants_all_posts">Wants all posts<br>
<th class="perm wants_all_posts"><div class="perm-descr">Wants all posts</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="wants_all_posts"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="wants_all_posts"><i class="fa fa-square-o fa-fw"></i></button>
</th>
<th class="perm can_upload_attachments">Attachments<br>
<th class="perm can_upload_attachments"><div class="perm-descr">Attachments</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="can_upload_attachments"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="can_upload_attachments"><i class="fa fa-square-o fa-fw"></i></button>
</th>
<th class="perm can_rebuild_site">Rebuild<br>
<th class="perm can_rebuild_site"><div class="perm-descr">Rebuild</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="can_rebuild_site"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="can_rebuild_site"><i class="fa fa-square-o fa-fw"></i></button>
</th>
<th class="perm can_transfer_post_authorship">Transfer authorship<br>
<th class="perm can_transfer_post_authorship"><div class="perm-descr">Transfer authorship</div>
<button type="button" class="btn btn-info btn-xs select_all-perm" data-perm="can_transfer_post_authorship"><i class="fa fa-check-square-o fa-fw"></i></button>
<button type="button" class="btn btn-info btn-xs select_none-perm" data-perm="can_transfer_post_authorship"><i class="fa fa-square-o fa-fw"></i></button>
</th>
@@ -93,7 +97,7 @@ $(document).ready(function() {
<tr class="u{{ uid }}">
<td class="uid">{{ uid }}</td>
<td class="username">{{ user.username }}</td>
{% for p in PERMISSIONS %}
{% for p in PERMISSIONS_E %}
<td class="perm
{% if p == 'active' %}
is_active
@@ -102,7 +106,7 @@ is_active
{% endif %}
">{{ display_permission(user, p) }}</td>
{% endfor %}
<td class="select_all"><button type="button" class="btn btn-info select_all-user" data-uid="{{ uid }}"><i class="fa fa-check-square-o fa-fw"></i></button> <button type="button" class="btn btn-info select_none-user" data-uid="{{ uid }}"><i class="fa fa-square-o fa-fw"></i></button></td>
<td class="select_all"><button type="button" class="btn btn-sm btn-info select_all-user" data-uid="{{ uid }}"><i class="fa fa-check-square-o fa-fw"></i></button> <button type="button" class="btn btn-sm btn-info select_none-user" data-uid="{{ uid }}"><i class="fa fa-square-o fa-fw"></i></button></td>
</tr>
{% endif %}
{% endfor %}
@@ -41,57 +41,59 @@ $('#deleteModal').on('show.bs.modal', function (event) {

<table class="table table-hover users" style="table-layout: fixed;">
<thead><tr>
<th class="uid">#</th>
<th class="username">Username</th>
<th class="realname">Real name</th>
<th class="email">E-mail address</th>
<th class="is_admin">Admin</th>
<th class="actions">Actions</th>
<th class="uid">#</th>
<th class="username">Username</th>
<th class="realname">Real name</th>
<th class="email">E-mail address</th>
<th class="is_admin">Admin</th>
<th class="actions">Actions</th>
</tr></thead>
% for uid, user in USERS:
% if user.active:
<tr>
% else:
<tr class="danger inactive-user">
% endif
<td class="uid">${uid}</td>
<td class="username">${user.username}</td>
<td class="realname">${user.realname}</td>
<td class="email">${user.email}</td>
<td class="actions">
% if user.is_admin:
<i class="fa fa-check"></i>
% else:
<i class="fa fa-times"></i>
% endif
</td>
<td class="actions">
<form action="${url_for('acp_users_edit')}" method="POST">${editform.csrf_token}
<input type="hidden" name="uid" value="${uid}">
<input type="hidden" name="action" value="edit">
<div class="btn-group" role="group">
% if user.active:
<button type="submit" class="btn btn-sm btn-info" title="Edit"><i class="fa fa-pencil fa-fw"></i> Edit</button>
% if user.uid == current_user.uid:
<button type="button" class="btn btn-sm btn-danger" title="Delete" disabled><i class="fa fa-trash fa-fw"></i> Delete</button>
% else:
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#deleteModal" data-username="${user.username}" data-uid="${uid}" data-direction="del" title="Delete"><i class="fa fa-trash fa-fw"></i> Delete</button>
% endif
% else:
<button type="button" class="btn btn-sm btn-info" title="Edit" disabled><i class="fa fa-pencil fa-fw"></i> Edit</button>
<button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#deleteModal" data-username="${user.username}" data-uid="${uid}" data-direction="undel" title="Undelete"><i class="fa fa-trash-o fa-fw"></i> Undelete</button>
% endif
</div>
</form>
<td class="uid">${uid}</td>
<td class="username">${user.username}</td>
<td class="realname">${user.realname}</td>
<td class="email">${user.email}</td>
<td class="actions">
% if user.is_admin:
<i class="fa fa-check"></i>
% else:
<i class="fa fa-times"></i>
% endif
</td>
<td class="actions">
<form action="${url_for('acp_users_edit')}" method="POST">${editform.csrf_token}
<input type="hidden" name="uid" value="${uid}">
<input type="hidden" name="action" value="edit">
<div class="btn-group" role="group">
% if user.active:
<button type="submit" class="btn btn-sm btn-info" title="Edit"><i class="fa fa-pencil fa-fw"></i> Edit</button>
% if user.uid == current_user.uid:
<button type="button" class="btn btn-sm btn-danger" title="Delete" disabled><i class="fa fa-trash fa-fw"></i> Delete</button>
% else:
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#deleteModal" data-username="${user.username}" data-uid="${uid}" data-direction="del" title="Delete"><i class="fa fa-trash fa-fw"></i> Delete</button>
% endif
% else:
<button type="button" class="btn btn-sm btn-info" title="Edit" disabled><i class="fa fa-pencil fa-fw"></i> Edit</button>
<button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#deleteModal" data-username="${user.username}" data-uid="${uid}" data-direction="undel" title="Undelete"><i class="fa fa-trash-o fa-fw"></i> Undelete</button>
% endif
</div>
</form>
</tr>
% endfor
<tr><form action="${url_for('acp_users_edit')}" method="POST">${editform.csrf_token}
<td></td>
<td><input name="username" placeholder="New user" class="form-control"></td>
<td><input name="action" value="new" type="hidden"></td>
<td></td>
<td></td>
<td><button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-plus-square fa-fw"></i> Create</button></td>
<td class="uid"><strong>Create:</strong></td>
<td colspan="4"><input name="username" placeholder="New user" class="form-control input-sm"></td>
<td><button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-plus-square fa-fw"></i> Create</button></td>
</form></tr>
<tr><form action="${url_for('acp_users_import')}" method="POST" enctype="multipart/form-data">${importform.csrf_token}
<td class="uid"><strong>Import:</strong></td>
<td colspan="4"><input name="tsv" type="file" required></td>
<td><button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-file-text-o fa-fw"></i> Import TSV</button></td>
</form></tr>
</table>

@@ -95,6 +95,15 @@
% endif
> User is an administrator
</label></div>
<div class="checkbox"><label><input type="checkbox" name="must_change_password"
% if user.must_change_password:
checked
% endif
% if user.uid == current_user.uid:
disabled
% endif
> User must change password on next login
</label></div>
<div class="checkbox"><label><input type="checkbox" name="can_edit_all_posts"
% if user.can_edit_all_posts:
checked

0 comments on commit 301993c

Please sign in to comment.
You can’t perform that action at this time.