fix: add normal login support
This commit is contained in:
@ -44,10 +44,15 @@
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<span class="navbar-text">
|
||||
<span class="navbar-text me-3">
|
||||
<i class="bi bi-clock"></i> Last Updated: <span id="last-updated">{{ "now" }}</span>
|
||||
</span>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/logout">
|
||||
<i class="bi bi-box-arrow-right"></i> Logout
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
110
templates/login.html
Normal file
110
templates/login.html
Normal file
@ -0,0 +1,110 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login - OpenWebUI Monitor</title>
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Bootstrap Icons -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.login-card {
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
|
||||
padding: 2rem;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
}
|
||||
.login-header {
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.login-header h1 {
|
||||
color: #667eea;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.login-header p {
|
||||
color: #6c757d;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-control {
|
||||
border-radius: 10px;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 2px solid #e9ecef;
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
.form-control:focus {
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
|
||||
}
|
||||
.btn-login {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
padding: 0.75rem 2rem;
|
||||
font-weight: bold;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
.btn-login:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.alert {
|
||||
border-radius: 10px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-card">
|
||||
<div class="login-header">
|
||||
<h1>
|
||||
<i class="bi bi-speedometer2"></i>
|
||||
OpenWebUI Monitor
|
||||
</h1>
|
||||
<p>Please enter your password to access the dashboard</p>
|
||||
</div>
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<i class="bi bi-exclamation-triangle"></i>
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="/login">
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">
|
||||
<i class="bi bi-lock"></i> Password
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="password"
|
||||
name="password"
|
||||
placeholder="Enter your password"
|
||||
required
|
||||
autofocus
|
||||
>
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary btn-login">
|
||||
<i class="bi bi-box-arrow-in-right"></i> Login
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -106,7 +106,7 @@
|
||||
{% for log in logs %}
|
||||
<tr>
|
||||
<td>
|
||||
<small class="text-muted">{{ log.datetime }}</small>
|
||||
<small class="text-muted timestamp" data-timestamp="{{ log.timestamp }}">{{ log.timestamp }}</small>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-secondary">{{ log.user_email }}</span>
|
||||
@ -229,6 +229,23 @@
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
// Convert timestamps to local timezone
|
||||
function formatTimestamp(timestamp) {
|
||||
const date = new Date(timestamp * 1000);
|
||||
return date.toLocaleString();
|
||||
}
|
||||
|
||||
// Update all timestamps on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const timestampElements = document.querySelectorAll('.timestamp');
|
||||
timestampElements.forEach(element => {
|
||||
const timestamp = element.getAttribute('data-timestamp');
|
||||
if (timestamp) {
|
||||
element.textContent = formatTimestamp(timestamp);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Note: Auto-refresh disabled for pagination functionality
|
||||
// Users can manually refresh using the refresh button
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user