- Web UI: - Added secure Authentication system (Login, 2 Roles: Admin/Viewer) - Added System Monitoring Dashboard (Health, Services, Power Mgmt) - Added User Management Interface (Create, Delete, Enable/Disable) - Added Device Mapping view in iSCSI tab (lsscsi output) - Backend: - Implemented secure session management (auth.php) - Added power management APIs (restart/shutdown appliance) - Added device mapping API - CLI: - Created global 'vtl' management tool - Added scripts for reliable startup (vtllibrary fix) - Installer: - Updated install.sh with new dependencies (tgt, sudoers, permissions) - Included all new components in build-installer.sh - Docs: - Consolidated documentation into docs/ folder
276 lines
8.0 KiB
HTML
276 lines
8.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Login - Adastra VTL</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
<style>
|
|
body {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
}
|
|
|
|
.login-container {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
padding: 3rem;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
}
|
|
|
|
.login-header {
|
|
text-align: center;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.login-header h1 {
|
|
margin: 0 0 0.5rem 0;
|
|
color: #333;
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.login-header p {
|
|
margin: 0;
|
|
color: #666;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.login-form {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.form-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.form-group label {
|
|
font-weight: 600;
|
|
color: #333;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.form-group input {
|
|
padding: 0.75rem 1rem;
|
|
border: 2px solid #e0e0e0;
|
|
border-radius: 8px;
|
|
font-size: 1rem;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.form-group input:focus {
|
|
outline: none;
|
|
border-color: #667eea;
|
|
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
}
|
|
|
|
.btn-login {
|
|
padding: 0.875rem 1.5rem;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
}
|
|
|
|
.btn-login:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
|
|
}
|
|
|
|
.btn-login:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.btn-login:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
}
|
|
|
|
.alert {
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
margin-bottom: 1rem;
|
|
display: none;
|
|
}
|
|
|
|
.alert-danger {
|
|
background: #fee;
|
|
border: 1px solid #fcc;
|
|
color: #c33;
|
|
}
|
|
|
|
.alert-info {
|
|
background: #e7f3ff;
|
|
border: 1px solid #b3d9ff;
|
|
color: #004085;
|
|
}
|
|
|
|
.default-credentials {
|
|
margin-top: 2rem;
|
|
padding: 1rem;
|
|
background: #f8f9fa;
|
|
border-radius: 8px;
|
|
font-size: 0.85rem;
|
|
color: #666;
|
|
}
|
|
|
|
.default-credentials strong {
|
|
color: #333;
|
|
}
|
|
|
|
.loading-spinner {
|
|
display: inline-block;
|
|
width: 16px;
|
|
height: 16px;
|
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
border-top-color: white;
|
|
border-radius: 50%;
|
|
animation: spin 0.6s linear infinite;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="login-container">
|
|
<div class="login-header">
|
|
<h1>🎞️ Adastra VTL</h1>
|
|
<p>Virtual Tape Library Management</p>
|
|
</div>
|
|
|
|
<div id="login-alert" class="alert"></div>
|
|
|
|
<form class="login-form" onsubmit="handleLogin(event)">
|
|
<div class="form-group">
|
|
<label for="username">Username</label>
|
|
<input type="text" id="username" name="username" required autofocus>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" required>
|
|
</div>
|
|
|
|
<button type="submit" class="btn-login" id="login-btn">
|
|
Sign In
|
|
</button>
|
|
</form>
|
|
|
|
<div class="default-credentials">
|
|
<strong>🔑 Default Credentials:</strong><br>
|
|
Username: <code>admin</code><br>
|
|
Password: <code>admin123</code><br>
|
|
<small>Please change the default password after first login.</small>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
async function handleLogin(event) {
|
|
event.preventDefault();
|
|
|
|
const username = document.getElementById('username').value;
|
|
const password = document.getElementById('password').value;
|
|
const loginBtn = document.getElementById('login-btn');
|
|
const alertDiv = document.getElementById('login-alert');
|
|
|
|
// Disable button and show loading
|
|
loginBtn.disabled = true;
|
|
loginBtn.innerHTML = '<span class="loading-spinner"></span> Signing in...';
|
|
alertDiv.style.display = 'none';
|
|
|
|
try {
|
|
const response = await fetch('api.php', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
action: 'login',
|
|
username: username,
|
|
password: password
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (data.success) {
|
|
// Show success message
|
|
alertDiv.className = 'alert alert-info';
|
|
alertDiv.style.display = 'block';
|
|
alertDiv.innerHTML = '<strong>✅ Success!</strong> Redirecting...';
|
|
|
|
// Redirect to main page
|
|
setTimeout(() => {
|
|
window.location.href = 'index.html';
|
|
}, 500);
|
|
} else {
|
|
// Show error message
|
|
alertDiv.className = 'alert alert-danger';
|
|
alertDiv.style.display = 'block';
|
|
alertDiv.innerHTML = '<strong>❌ Error:</strong> ' + (data.error || 'Login failed');
|
|
|
|
// Re-enable button
|
|
loginBtn.disabled = false;
|
|
loginBtn.innerHTML = 'Sign In';
|
|
|
|
// Clear password field
|
|
document.getElementById('password').value = '';
|
|
document.getElementById('password').focus();
|
|
}
|
|
} catch (error) {
|
|
alertDiv.className = 'alert alert-danger';
|
|
alertDiv.style.display = 'block';
|
|
alertDiv.innerHTML = '<strong>❌ Error:</strong> ' + error.message;
|
|
|
|
loginBtn.disabled = false;
|
|
loginBtn.innerHTML = 'Sign In';
|
|
}
|
|
}
|
|
|
|
// Check if already logged in
|
|
window.addEventListener('DOMContentLoaded', async () => {
|
|
try {
|
|
const response = await fetch('api.php', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
action: 'check_session'
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (data.success && data.logged_in) {
|
|
// Already logged in, redirect to main page
|
|
window.location.href = 'index.html';
|
|
}
|
|
} catch (error) {
|
|
console.error('Session check failed:', error);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |