Skip to content

Commit

Permalink
Merge pull request #239 from fmfi-svt/mrshu/token-list
Browse files Browse the repository at this point in the history
add: Admin Tokens list
  • Loading branch information
tvinar authored Feb 13, 2024
2 parents a07a58f + 78ae8f5 commit de71614
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
45 changes: 45 additions & 0 deletions eprihlaska/templates/admin_tokens_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

{% extends "bootstrap/base.html" %}
{% import "bootstrap/fixes.html" as fixes %}
{% import "bootstrap/utils.html" as util %}


{% block content %}
<div class="container">
<h1 class="section-title">
{% block title %}User tokens{% endblock title %}
</h1>
<div class="container">
<div class="row">
<div class="col-lg-12 text-right">
<a href="https://login.uniba.sk/logout.cgi"><strong>Odhlásiť sa</strong></a>
</div>
</div>

<div class="row">
<table class="table table-hover">
<tbody>
<tr>
<th>Email</th>
<th>Token</th>
<th>Link</th>
<th>Valid Until</th>
</tr>
{% for token in tokens %}
{% with user=token.user_id|get_user %}
<tr>
<td>{{ user.email }}</td>
<td>{{ token.hash }}</td>
<td>{{ url_for('forgotten_password_hash', hash=token.hash, _external=True) }}</td>
<td>{{ token.valid_until }}</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
</div>



{% endblock %}
12 changes: 12 additions & 0 deletions eprihlaska/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,3 +1241,15 @@ def admin_impersonate_user(id):
session.clear()
login_user(user)
return redirect(url_for('index'))


@app.template_filter('get_user')
def get_user_filter(user_id):
return User.query.get(user_id)


@app.route('/admin/tokens/list')
@require_remote_user
def admin_tokens_list():
tokens = ForgottenPasswordToken.query.all()
return render_template('admin_tokens_list.html', tokens=tokens)

0 comments on commit de71614

Please sign in to comment.