commit b06ab36f2bea54db5677f917fa105fa8a2872fa3
parent 1cb9767cc714def2efac696286530278b723a73d
Author: parazyd <parazyd@dyne.org>
Date: Sun, 27 Jan 2019 17:59:45 +0100
List also inactive users in /users.
Diffstat:
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/diaspora.py b/diaspora.py
@@ -471,7 +471,8 @@ def users():
if request.args.get('delid'):
delete_user(request.args.get('delid'))
- userlist = get_multiple_users('is_active', 1)
+ # userlist = get_multiple_users('is_active', 1)
+ userlist = get_multiple_users(None, None)
return render_template('users.html', users=userlist)
diff --git a/templates/users.html b/templates/users.html
@@ -18,6 +18,7 @@
<th scope="col">Email</th>
<th scope="col">Password</th>
<th scope="col">Cap</th>
+ <th scope="col">Active</th>
<th scope="col">First seen</th>
<th scope="col">Apply</th>
<th scope="col">Delete</th>
@@ -38,6 +39,7 @@
<td>{{ i['email'] }}</td>
<td><input form="form_{{ i['id'] }}" class="form-control" type="text" name="password" placeholder="New password"></td>
<td><input form="form_{{ i['id'] }}" class="form-control" type="text" name="cap" placeholder="{{ i['cap'] }} (0=writer, 2=admin)"></td>
+ <td>{{ i['is_active'] }}</td>
<td>{{ parsetime(i['first_seen']) }}</td>
<td>
<button type="submit" form="form_{{ i['id'] }}" class="btn btn-outline-success">
diff --git a/utils.py b/utils.py
@@ -146,7 +146,10 @@ def get_multiple_users(col, val, reverse=False):
"""
Returns a list of users where col=val.
"""
- rows = sql_select_col_where('*', col, val, table='users')
+ if col and val:
+ rows = sql_select_col_where('*', col, val, table='users')
+ else:
+ rows = sql_select_col('*', table='users')
users = []
for i in rows: