-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathindex.html
More file actions
81 lines (80 loc) · 3.35 KB
/
index.html
File metadata and controls
81 lines (80 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>API Keys</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1>
API Key Admin Interface
</h1>
{% if flags.banner %}
<div class="alert alert-primary" role="alert">
{{ flags.banner }}
</div>
{% endif %}
{% if mode == 'overview' %}
<h2 class="mt-5 mb-3">Registered Users</h2>
<table class="table table-striped">
<thead>
<th scope="col">ID</th>
<th scope="col">API Key</th>
<th scope="col">Email</th>
<th scope="col">Roles</th>
<th scope="col">Actions</th>
</thead>
<tbody>
{% for user in users %}
<tr>
<th scope="row">{{ user.id }}</th>
<td>{{ user.api_key }}</td>
<td>{{ user.email }}</td>
<td>{{ ','.join(user.roles) }}</td>
<td>
<a class="btn btn-secondary btn-sm" href="./{{user.id}}?auth={{token}}">Edit</a>
<a class="btn btn-secondary btn-sm" href="./{{user.id}}?auth={{token}}&delete=yes">Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h2 class="mt-5 mb-3">Register New User</h2>
{% else %}
<h2 class="mt-5 mb-3">
<a href="./?auth={{token}}">< Back</a>
Edit User {{user.id}}
</h2>
{% endif %}
<form method="POST">
<input type="hidden" name="auth" value="{{token}}" />
<div class="form-group">
<label for="api_key">API Key</label>
<input type="text" class="form-control" name="api_key" id="api_key" value="{{user.api_key}}" required />
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="text" class="form-control" name="email" id="email" value="{{user.email}}" required />
</div>
<div class="form-group">
<label for="roles">Roles</label>
{% for role in roles %}
<label class="form-check-label form-check">
<input type="checkbox" name="roles" value="{{role}}" {{'checked' if role in user.roles else ''}}>
{{role}}
</label>
{% endfor %}
</div>
{% if mode == 'overview' %}
<button type="submit" class="btn btn-primary btn-block">Add</button>
{% else %}
<button type="submit" class="btn btn-primary btn-block">Update</button>
<button type="submit" name="delete" class="btn btn-secondary btn-block">Delete</button>
{% endif %}
</form>
</div>
</body>
</html>