Add initial setup and admin page
This commit is contained in:
7
templates/401.html.tera
Normal file
7
templates/401.html.tera
Normal file
@@ -0,0 +1,7 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="m-3">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
17
templates/_basic.html.tera
Normal file
17
templates/_basic.html.tera
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% block head %}
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}{% endblock title %}</title>
|
||||
<link href="style.css" rel="stylesheet" />
|
||||
{% endblock head %}
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}
|
||||
<div id="header">{% block header %}{% endblock header %}</div>
|
||||
<div id="content">{% block content %}{% endblock content %}</div>
|
||||
<div id="footer">{% block footer %}{% endblock footer %}</div>
|
||||
{% endblock body %}
|
||||
</body>
|
||||
</html>
|
||||
48
templates/_layout.html.tera
Normal file
48
templates/_layout.html.tera
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="dark">
|
||||
<head>
|
||||
{% block head %}
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}{% endblock title %}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
||||
{#<link href="style.css" rel="stylesheet" />#}
|
||||
{% endblock head %}
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}
|
||||
<div id="header">
|
||||
{% block header %}
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">GPodder-rs</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
{% if username is defined and username is string %}
|
||||
{% if admin %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin">Admin</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/account">Account ({{username}})</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/login">Login</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{% endblock header %}
|
||||
</div>
|
||||
<div id="content">{% block content %}{% endblock %}</div>
|
||||
<div id="footer">{% block footer %}{% endblock %}</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
|
||||
{% endblock body %}
|
||||
</body>
|
||||
</html>
|
||||
15
templates/account.html.tera
Normal file
15
templates/account.html.tera
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block content %}
|
||||
<form class="p-4 d-flex container-fluid" method="POST" action="/update_password">
|
||||
<div>
|
||||
<label for="pass" class="form-label">Update Password</label>
|
||||
</div>
|
||||
<div class="flex-grow-1 mx-4">
|
||||
<input type="password" class="form-control" id="pass" name="password">
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary">Update Password</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
49
templates/admin.html.tera
Normal file
49
templates/admin.html.tera
Normal file
@@ -0,0 +1,49 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="vstack gap-3 m-3">
|
||||
<h3>Create new user</h3>
|
||||
<form method="POST" action="/create_user">
|
||||
<div class="mb-3">
|
||||
<label for="user" class="form-label">Username</label>
|
||||
<input type="username" class="form-control" id="user" name="username">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="pass" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="pass" name="password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label">Role</label>
|
||||
<select class="form-select" aria-label="User Role" name="role" id="role">
|
||||
<option selected value="user">User</option>
|
||||
<option value="admin">Admin</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create new user</button>
|
||||
</form>
|
||||
<hr />
|
||||
<h3>Edit user</h3>
|
||||
<form method="POST" action="/edit_user">
|
||||
<div class="mb-3">
|
||||
<label for="user" class="form-label">Username</label>
|
||||
<select class="form-select" aria-label="User to edit" name="username" id="user">
|
||||
{% for user in users %}
|
||||
<option value="{{ user }}">{{ user }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="pass" class="form-label">Password (leave blank to skip changing)</label>
|
||||
<input type="password" class="form-control" id="pass" name="password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label">Role</label>
|
||||
<select class="form-select" aria-label="User Role" name="role" id="role">
|
||||
<option selected value="user">User</option>
|
||||
<option value="admin">Admin</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create new user</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
2
templates/dash.html.tera
Normal file
2
templates/dash.html.tera
Normal file
@@ -0,0 +1,2 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
15
templates/initial_setup.html.tera
Normal file
15
templates/initial_setup.html.tera
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block content %}
|
||||
<form class="m-3" method="POST" action="/initial_setup">
|
||||
<div class="mb-3">
|
||||
<label for="user" class="form-label">Admin Username</label>
|
||||
<input type="username" class="form-control" id="user" name="admin_username">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="pass" class="form-label">Admin Password</label>
|
||||
<input type="password" class="form-control" id="pass" name="admin_password">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Complete initial setup</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
15
templates/login.html.tera
Normal file
15
templates/login.html.tera
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block content %}
|
||||
<form class="m-3" method="POST" action="/login">
|
||||
<div class="mb-3">
|
||||
<label for="user" class="form-label">Username</label>
|
||||
<input type="username" class="form-control" id="user" name="username">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="pass" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="pass" name="password">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user