auth support

This commit is contained in:
2019-09-11 02:51:55 +03:00
parent 39be8cebf1
commit 7de6a5fcc9
21 changed files with 471 additions and 14 deletions

View File

@ -8,10 +8,27 @@
<body>
<center>
{% if logged is defined and logged %}
<form action="/api/v1/logout" method="post">
logged in as {{ logged|e }}
<input name="logout" id="logout" type="submit" value="logout"/>
</form>
{% else %}
<form action="/api/v1/login" method="post">
<input name="username" id="username" title="username" placeholder="username" type="text" required/>
<input name="password" id="password" title="password" placeholder="password" type="password" required/>
<input name="login" id="login" type="submit" value="login"/>
</form>
{% endif %}
<br>
<h2><a href="/party" title="party">party</a></h2>
<h2><a href="/bis" title="bis management">bis</a></h2>
<h2><a href="/loot" title="loot management">loot</a></h2>
<h2><a href="/suggest" title="suggest loot">suggest</a></h2>
<hr>
<h2><a href="/admin/users" title="manage users">manage users</a></h2>
</center>
</body>
</html>

51
templates/users.jinja2 Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Users</title>
<link href="{{ static('styles.css') }}" rel="stylesheet" type="text/css">
</head>
<body>
<h2>users</h2>
{% include "error.jinja2" %}
{% include "search_line.jinja2" %}
<form action="/admin/users" method="post">
<input name="username" id="username" title="username" placeholder="username" type="text"/>
<input name="password" id="password" title="password" placeholder="password" type="password"/>
<select name="permission" id="permission" title="permission">
<option>get</option>
<option>post</option>
</select>
<input name="action" id="action" type="hidden" value="add"/>
<input name="add" id="add" type="submit" value="add"/>
</form>
<table id="result">
<tr>
<th>username</th>
<th>permission</th>
<th></th>
</tr>
{% for user in users %}
<tr>
<td class="include_search">{{ user.username|e }}</td>
<td>{{ user.permission|e }}</td>
<td>
<form action="/admin/users" method="post">
<input name="username" id="username" type="hidden" value="{{ user.username|e }}"/>
<input name="action" id="action" type="hidden" value="remove"/>
<input name="remove" id="remove" type="submit" value="x"/>
</form>
</td>
</tr>
{% endfor %}
</table>
{% include "export_to_csv.jinja2" %}
{% include "root.jinja2" %}
{% include "search.jinja2" %}
</body>
</html>