Add /dashboard
This commit is contained in:
parent
f35f0ebcb1
commit
e9fa6b6f25
|
@ -4,9 +4,11 @@ const router = express.Router();
|
||||||
|
|
||||||
// GET /login
|
// GET /login
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.send("Test")
|
if (req.session.user) return res.redirect('/dashboard');
|
||||||
|
res.redirect('/login'); // Assumes you have a 'login' view/template
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
||||||
// I genuinely have no clue if this'll work.... but hey, it's worth a shot.
|
// I genuinely have no clue if this'll work.... but hey, it's worth a shot.
|
||||||
|
// It worked, so yea.
|
14
routes/dashboard.js
Normal file
14
routes/dashboard.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const express = require('express');
|
||||||
|
const db = global.db;
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
// GET /login
|
||||||
|
router.get('/', (req, res) => {
|
||||||
|
if (!req.session.user) return res.redirect('/login');
|
||||||
|
return res.render("dashboard", { sessionData: req.session });
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
|
|
||||||
|
// I genuinely have no clue if this'll work.... but hey, it's worth a shot.
|
||||||
|
// It worked, so yea.
|
61
views/dashboard.ejs
Normal file
61
views/dashboard.ejs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Dashboard</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background: #f5f5f5;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.dashboard-container {
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 60px auto;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||||
|
padding: 32px 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.dashboard-title {
|
||||||
|
font-size: 1.5em;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.dashboard-buttons button {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin: 12px 0;
|
||||||
|
padding: 12px;
|
||||||
|
font-size: 1em;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #1976d2;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
.dashboard-buttons button:hover {
|
||||||
|
background: #1565c0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="dashboard-container">
|
||||||
|
<div class="dashboard-title">Dashboard</div>
|
||||||
|
<div class="dashboard-buttons">
|
||||||
|
<form action="/event-logs" method="get">
|
||||||
|
<button type="submit">Event Logs</button>
|
||||||
|
</form>
|
||||||
|
<form action="/access-control-list" method="get">
|
||||||
|
<button type="submit">Access Control List</button>
|
||||||
|
</form>
|
||||||
|
<form action="/audit-logs" method="get">
|
||||||
|
<button type="submit">Audit Logs</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue