Added in a admin page and auth checks

This commit is contained in:
Benjamyn Love committed 2020-01-29 11:53:53 +11:00
1 parent 853089f3b5
commit 40242afa36
5 files changed
+168 -54

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
{% include "header.html" %}
<body>
<h1 class="text-center">LIST USERS</h1>
<div class="container">
<table class="table table-striped table-dark table-hover">
<thead>
<tr>
<th scope="col">Username</th>
<th scope="col">Admin</th>
<th scope="col">Change Password</th>
</tr>
</thead>
<tbody>
{% for x in data["users"] %}
<tr scope="row">
<td>{{x[0]}}</td>
<td>{% if x[1] == 1 %} Yes {% else %} No {% endif %}</td>
<td> Implement later </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<hr>
<h1 class="text-center">ADD NEW USERS</h1>
<div class="container">
<form class="loginform" action="/post" method="POST">
<div class="form-group row">
<label for="addbox" class="col-sm-2 col-form-label" >Username</label>
<div class="col-sm-10">
<input type=text class="form-control" id="addbox" type="text" name="username" />
</div>
</div>
<div class="form-group row">
<label for="addbox" class="col-sm-2 col-form-label" >Password</label>
<div class="col-sm-10">
<input class="form-control" id="addbox" type="password" name="password"/>
</div>
<div class="form-group" style="padding-top: 10px; padding-left: 10px;">
<input class="btn btn-secondary" id="logbtn" type="submit" name="newuser" value="Create new account" />
</div>
</div>
</form>
<div id="logout" style="padding-top: 3px;">
<a href="/">
<button onclick="window.location='admin'" class="btn btn-secondary"><i style="padding-top: 3px;"
class="material-icons">
home
</i></button></a>
</div>
</div>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</body>
</html>
+34 -24
View File
@@ -1,29 +1,39 @@
{% include "header.html" %}
<body>
<h1 class="container" style="text-align: center">{{ data["title"] }}</h1>
<!-- <aside> -->
<div id="addForm">
{% include "addForm.html" %}
<body>
<h1 class="container" style="text-align: center">{{ data["title"] }}, {{data["username"].title()}}</h1>
<!-- <aside> -->
<div id="addForm">
{% include "addForm.html" %}
</div>
</div>
<!-- </aside> -->
<div class="container">
{% include "list.html" %}
</div>
<div id="logout">
<form action="/post" method="POST">
<button type="submit" name="logout" class="btn btn-secondary"><i style="padding-top: 3px;"
class="material-icons">
exit_to_app
</i></button>
</form>
<div style="padding-top: 3px;">
<a href="admin">
<button onclick="window.location='admin'" class="btn btn-secondary"><i style="padding-top: 3px;"
class="material-icons">
vpn_key
</i></button></a>
</div>
</div>
<!-- </aside> -->
<div class="container" >
{% include "list.html" %}
</div>
<div id="logout">
<form action="/post" method="POST">
<button type="submit" name="logout" class="btn btn-secondary"><i style="padding-top: 3px;" class="material-icons">
exit_to_app
</i></button>
</form>
</div>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</body>
</html>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</body>
</html>
+29 -25
View File
@@ -1,27 +1,31 @@
<table class="table table-striped table-dark table-hover">
<thead class="">
<tr>
<th scope="col">Item</th>
<th scope="col">Requester</th>
<th scope="col">Gottem?</th>
<th scope="col">Remove</th>
</tr>
{% for x in data["results"] %}
<tbody>
<tr scope="row" id="row-{{x[0]}}">
<td>{{x[1]}}</td>
<td>{{x[3].title()}}</td>
<td> {% if x[2] == 0 %}
<form><button class="btn btn-secondary" type="submit" formaction="/post" formmethod="POST" name="got" value="{{x[0]}}">No</button></form>
{% else %}
<form><button class="btn btn-secondary" type="submit" formaction="/post" formmethod="POST" name="ungot" value="{{x[0]}}">Yes</button></form>
{% endif %}</td>
<td><form>
<button class="btn btn-secondary" type="submit" formaction="/post" formmethod="POST" name="rem" value="{{x[0]}}">Remove</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
<thead class="">
<tr>
<th scope="col">Item</th>
<th scope="col">Requester</th>
<th scope="col">Gottem?</th>
<th scope="col">Remove</th>
</tr>
</thead>
<tbody>
{% for x in data["results"] %}
<tr scope="row" id="row-{{x[0]}}">
<td>{{x[1]}}</td>
<td>{{x[3].title()}}</td>
<td> {% if x[2] == 0 %}
<form><button class="btn btn-secondary" type="submit" formaction="/post" formmethod="POST" name="got"
value="{{x[0]}}">No</button></form>
{% else %}
<form><button class="btn btn-secondary" type="submit" formaction="/post" formmethod="POST" name="ungot"
value="{{x[0]}}">Yes</button></form>
{% endif %}</td>
<td>
<form>
<button class="btn btn-secondary" type="submit" formaction="/post" formmethod="POST" name="rem"
value="{{x[0]}}">Remove</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>