Skip to content

Commit de71614

Browse files
authored
Merge pull request #239 from fmfi-svt/mrshu/token-list
add: Admin Tokens list
2 parents a07a58f + 78ae8f5 commit de71614

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
{% extends "bootstrap/base.html" %}
3+
{% import "bootstrap/fixes.html" as fixes %}
4+
{% import "bootstrap/utils.html" as util %}
5+
6+
7+
{% block content %}
8+
<div class="container">
9+
<h1 class="section-title">
10+
{% block title %}User tokens{% endblock title %}
11+
</h1>
12+
<div class="container">
13+
<div class="row">
14+
<div class="col-lg-12 text-right">
15+
<a href="https://login.uniba.sk/logout.cgi"><strong>Odhlásiť sa</strong></a>
16+
</div>
17+
</div>
18+
19+
<div class="row">
20+
<table class="table table-hover">
21+
<tbody>
22+
<tr>
23+
<th>Email</th>
24+
<th>Token</th>
25+
<th>Link</th>
26+
<th>Valid Until</th>
27+
</tr>
28+
{% for token in tokens %}
29+
{% with user=token.user_id|get_user %}
30+
<tr>
31+
<td>{{ user.email }}</td>
32+
<td>{{ token.hash }}</td>
33+
<td>{{ url_for('forgotten_password_hash', hash=token.hash, _external=True) }}</td>
34+
<td>{{ token.valid_until }}</td>
35+
</tr>
36+
{% endwith %}
37+
{% endfor %}
38+
</tbody>
39+
</table>
40+
</div>
41+
</div>
42+
43+
44+
45+
{% endblock %}

eprihlaska/views.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,3 +1241,15 @@ def admin_impersonate_user(id):
12411241
session.clear()
12421242
login_user(user)
12431243
return redirect(url_for('index'))
1244+
1245+
1246+
@app.template_filter('get_user')
1247+
def get_user_filter(user_id):
1248+
return User.query.get(user_id)
1249+
1250+
1251+
@app.route('/admin/tokens/list')
1252+
@require_remote_user
1253+
def admin_tokens_list():
1254+
tokens = ForgottenPasswordToken.query.all()
1255+
return render_template('admin_tokens_list.html', tokens=tokens)

0 commit comments

Comments
 (0)