aboutsummaryrefslogtreecommitdiff
path: root/labbot/addons/dashboard/templates
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2022-09-07 16:07:22 +0200
committerJan200101 <sentrycraft123@gmail.com>2022-09-07 16:07:22 +0200
commit234bb54e699bbacde75b36a6dda4adc4d636da5a (patch)
treeb6a97f7c64c503a2719434d4e3204e06c6352f2c /labbot/addons/dashboard/templates
parente866d2e9d08cbe51da8194c848078ee258bd8c58 (diff)
downloadlab-bot-234bb54e699bbacde75b36a6dda4adc4d636da5a.tar.gz
lab-bot-234bb54e699bbacde75b36a6dda4adc4d636da5a.zip
Implement Dashboard login, hide dashboard config
Diffstat (limited to 'labbot/addons/dashboard/templates')
-rw-r--r--labbot/addons/dashboard/templates/base.html2
-rw-r--r--labbot/addons/dashboard/templates/login.html78
-rw-r--r--labbot/addons/dashboard/templates/sidebar.html25
3 files changed, 88 insertions, 17 deletions
diff --git a/labbot/addons/dashboard/templates/base.html b/labbot/addons/dashboard/templates/base.html
index 03a5532..8fa7d76 100644
--- a/labbot/addons/dashboard/templates/base.html
+++ b/labbot/addons/dashboard/templates/base.html
@@ -129,7 +129,7 @@
</button>
<div class="navbar-nav">
<div class="nav-item text-nowrap">
- <a class="nav-link px-3" href="#">Sign out</a>
+ <a class="nav-link px-3" href="/logout">Sign out</a>
</div>
</div>
</header>
diff --git a/labbot/addons/dashboard/templates/login.html b/labbot/addons/dashboard/templates/login.html
new file mode 100644
index 0000000..82995c4
--- /dev/null
+++ b/labbot/addons/dashboard/templates/login.html
@@ -0,0 +1,78 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="description" content="">
+ <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
+ <meta name="generator" content="Hugo 0.101.0">
+ <title>Signin Template ยท Bootstrap v5.2</title>
+
+ <link rel="canonical" href="https://getbootstrap.com/docs/5.2/examples/sign-in/">
+
+
+
+
+
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
+
+ <style>
+ html, body {
+ height: 100%;
+ }
+
+ body {
+ display: flex;
+ align-items: center;
+ padding-top: 40px;
+ padding-bottom: 40px;
+ background-color: #f5f5f5;
+ }
+
+ .form-signin {
+ max-width: 330px;
+ padding: 15px;
+ }
+
+ .form-signin .form-floating:focus-within {
+ z-index: 2;
+ }
+
+ .form-signin input[type="email"] {
+ margin-bottom: -1px;
+ border-bottom-right-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .form-signin input[type="password"] {
+ margin-bottom: 10px;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+ }
+
+ </style>
+ </head>
+ <body class="text-center">
+
+<main class="form-signin w-100 m-auto">
+ <form method="POST">
+ <h1 class="h3 mb-3 fw-normal">Login - {{ bot.name }}</h1>
+
+ <div class="form-floating">
+ <input type="input" class="form-control" id="username" name="username">
+ <label for="username">username</label>
+ </div>
+ <div class="form-floating">
+ <input type="password" class="form-control" id="password" name="password">
+ <label for="password">password</label>
+ </div>
+
+ <button class="w-100 btn btn-lg btn-primary" type="submit">Sign in</button>
+ </form>
+</main>
+
+
+
+ </body>
+</html>
diff --git a/labbot/addons/dashboard/templates/sidebar.html b/labbot/addons/dashboard/templates/sidebar.html
index f234f54..f90e999 100644
--- a/labbot/addons/dashboard/templates/sidebar.html
+++ b/labbot/addons/dashboard/templates/sidebar.html
@@ -26,12 +26,14 @@
</h6>
<ul class="nav flex-column mb-2">
{% for addon in bot.addons %}
- <li class="nav-item">
- <a class="nav-link" href="/settings/{{ addon }}">
- <span data-feather="file-plus" class="align-text-bottom"></span>
- {{ addon }}
- </a>
- </li>
+ {% if addon != "dashboard" %}
+ <li class="nav-item">
+ <a class="nav-link" href="/settings/{{ addon }}">
+ <span data-feather="file-plus" class="align-text-bottom"></span>
+ {{ addon }}
+ </a>
+ </li>
+ {% endif %}
{% endfor %}
</ul>
@@ -54,16 +56,7 @@
<script>
function getHealth()
{
- var href = window.location.href;
- var osi = -2;
- var nsi = -1;
-
- while (nsi > osi)
- {
- osi = nsi;
- nsi = href.indexOf("/", nsi+1);
- }
- href = href.slice(0, osi+1) + "health"
+ var href = window.location.origin + "/health"
var xhttp = new XMLHttpRequest();
xhttp.onload = function() {