update
This commit is contained in:
30
Sean/inusers.js
Normal file
30
Sean/inusers.js
Normal file
@ -0,0 +1,30 @@
|
||||
// inusers.js
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// Middleware to check if the user is authenticated
|
||||
function isAuthenticated(req, res, next) {
|
||||
if (req.session && req.session.authenticated) {
|
||||
return next();
|
||||
} else {
|
||||
res.redirect('/login');
|
||||
}
|
||||
}
|
||||
|
||||
// InUsers route (renders the InUsers tab)
|
||||
router.get('/', isAuthenticated, (req, res) => {
|
||||
res.render('inusers');
|
||||
});
|
||||
|
||||
// User Data route
|
||||
router.get('/userdata', isAuthenticated, (req, res) => {
|
||||
res.render('user-data');
|
||||
});
|
||||
|
||||
// Edit User Data route
|
||||
router.get('/edituserdata', isAuthenticated, (req, res) => {
|
||||
res.render('edit-user-data');
|
||||
});
|
||||
|
||||
module.exports = router;
|
@ -5,7 +5,7 @@ const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
require('dotenv').config()
|
||||
require('dotenv').config();
|
||||
|
||||
// MySQL setup (replace with your MySQL connection details)
|
||||
const mysqlConfig = {
|
||||
@ -13,6 +13,7 @@ const mysqlConfig = {
|
||||
user: process.env.user,
|
||||
password: process.env.password,
|
||||
database: process.env.database,
|
||||
timezone: 'Z', // Set the timezone to UTC
|
||||
};
|
||||
|
||||
const mysqlConnection = mysql.createConnection(mysqlConfig);
|
||||
@ -25,7 +26,6 @@ app.get('/login', (req, res) => {
|
||||
res.render('login');
|
||||
});
|
||||
|
||||
// Check if the user is authenticated before accessing certain routes
|
||||
function isAuthenticated(req, res, next) {
|
||||
if (req.session && req.session.authenticated) {
|
||||
return next();
|
||||
@ -34,41 +34,91 @@ function isAuthenticated(req, res, next) {
|
||||
}
|
||||
}
|
||||
|
||||
// Login route
|
||||
app.post('/login', (req, res) => {
|
||||
let { username, password } = req.body;
|
||||
|
||||
// Trim leading and trailing spaces from username
|
||||
username = username.trim();
|
||||
|
||||
// Validate username and password against MySQL
|
||||
const sql = 'SELECT * FROM users WHERE username = ? AND password = ?';
|
||||
mysqlConnection.query(sql, [username, password], (error, results) => {
|
||||
const loginSql = 'SELECT * FROM users WHERE username = ? AND password = ?';
|
||||
const updateLastLoginSql = 'UPDATE users SET lastLogin = CURRENT_TIMESTAMP WHERE username = ?';
|
||||
|
||||
// Check credentials and retrieve user information
|
||||
const connection = mysql.createConnection(mysqlConfig);
|
||||
|
||||
connection.connect();
|
||||
|
||||
connection.query(loginSql, [username, password], (error, results) => {
|
||||
if (error) {
|
||||
console.error('Error executing login query:', error);
|
||||
res.status(500).send('Internal Server Error');
|
||||
connection.end(); // Close the connection in case of an error
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('SQL Query:', sql, [username, password]);
|
||||
console.log('Query Results:', results);
|
||||
|
||||
if (results.length === 0) {
|
||||
res.status(401).send('Invalid username or password');
|
||||
connection.end(); // Close the connection when not needed anymore
|
||||
} else {
|
||||
// Set session data for authentication
|
||||
req.session.authenticated = true;
|
||||
req.session.username = username;
|
||||
// Update lastLogin field for the user
|
||||
connection.query(updateLastLoginSql, [username], (updateError, updateResults) => {
|
||||
if (updateError) {
|
||||
console.error('Error updating lastLogin:', updateError);
|
||||
res.status(500).send('Internal Server Error');
|
||||
connection.end(); // Close the connection in case of an error
|
||||
return;
|
||||
}
|
||||
|
||||
// Redirect to the home page or any other protected route
|
||||
res.redirect('/home');
|
||||
// Check if the update affected any rows
|
||||
if (updateResults.affectedRows > 0) {
|
||||
// Set session data for authentication
|
||||
req.session.authenticated = true;
|
||||
req.session.username = username;
|
||||
|
||||
// Redirect to the home page or any other protected route
|
||||
res.redirect('/home');
|
||||
} else {
|
||||
res.status(500).send('Error updating lastLogin. No rows affected.');
|
||||
}
|
||||
|
||||
connection.end(); // Close the connection when not needed anymore
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Home route (protected by authentication)
|
||||
// Update your /home route to retrieve the overall last 10 logins for all users
|
||||
app.get('/home', isAuthenticated, (req, res) => {
|
||||
res.render('home', { username: req.session.username });
|
||||
// Retrieve the overall last 10 logins for all users
|
||||
const loginsQuery = 'SELECT username, lastLogin FROM users ORDER BY lastLogin DESC LIMIT 10';
|
||||
|
||||
mysqlConnection.query(loginsQuery, (error, loginResults) => {
|
||||
if (error) {
|
||||
console.error('Error executing login logs query:', error);
|
||||
res.status(500).send('Internal Server Error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Log the results on the server side
|
||||
console.log('Login Logs on Server:', loginResults);
|
||||
|
||||
// Render the home page with login logs data
|
||||
res.render('home', { username: req.session.username, loginLogs: loginResults });
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/inusers', isAuthenticated, (req, res) => {
|
||||
// Fetch all user data from the database
|
||||
const allUsersQuery = 'SELECT * FROM users';
|
||||
|
||||
mysqlConnection.query(allUsersQuery, (error, allUsers) => {
|
||||
if (error) {
|
||||
console.error('Error fetching all users:', error);
|
||||
res.status(500).send('Internal Server Error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Render the inusers page with all user data
|
||||
res.render('inusers', { allUsers: allUsers });
|
||||
});
|
||||
});
|
||||
|
||||
app.use(express.static('views'));
|
||||
@ -76,5 +126,3 @@ app.use(express.static('views'));
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on port ${PORT}`);
|
||||
});
|
||||
|
||||
|
||||
|
30
Sean/views/allusers.ejs
Normal file
30
Sean/views/allusers.ejs
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>All Users</title>
|
||||
<!-- Add any additional styles or dependencies here -->
|
||||
</head>
|
||||
<body>
|
||||
<h2>All Users</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<!-- Add additional columns as needed -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for (let i = 0; i < users.length; i++) { %>
|
||||
<tr>
|
||||
<td><%= users[i].username %></td>
|
||||
<!-- Add additional columns as needed -->
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -1,270 +1,162 @@
|
||||
<!-- views/home.ejs -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible"
|
||||
content="IE=edge">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,
|
||||
initial-scale=1.0">
|
||||
<title>GeeksForGeeks</title>
|
||||
<link rel="stylesheet"
|
||||
href="style.css">
|
||||
<link rel="stylesheet"
|
||||
href="responsive.css">
|
||||
,
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Home</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Arial', sans-serif;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
height: 100%;
|
||||
width: 250px;
|
||||
position: fixed;
|
||||
background-color: #333;
|
||||
padding-top: 60px;
|
||||
transition: 0.5s;
|
||||
}
|
||||
|
||||
#sidebar img {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#sidebar a {
|
||||
padding: 10px 15px;
|
||||
text-decoration: none;
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
display: block;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#sidebar a:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 250px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
#sidebar {
|
||||
width: 0;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#sidebarCollapse {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#sidebarCollapse span {
|
||||
display: block;
|
||||
background: white;
|
||||
height: 5px;
|
||||
width: 30px;
|
||||
margin: 6px auto;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#sidebarCollapse:hover span:nth-child(1) {
|
||||
transform: rotate(-45deg) translate(-5px, 6px);
|
||||
}
|
||||
|
||||
#sidebarCollapse:hover span:nth-child(2) {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#sidebarCollapse:hover span:nth-child(3) {
|
||||
transform: rotate(45deg) translate(-5px, -6px);
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 80%;
|
||||
margin: 20px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #dddddd;
|
||||
text-align: left;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="sidebar">
|
||||
<img src="LOGO.PNG" alt="Custom Image">
|
||||
<div id="sidebarCollapse">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
<a href="/inusers">In-House Users</a>
|
||||
<a href="#">Users</a>
|
||||
<a href="#">Data Analysis</a>
|
||||
<a href="#">Logout</a>
|
||||
</div>
|
||||
|
||||
<header>
|
||||
<div id="content">
|
||||
<h2>Welcome to the Home Page, <%= username %>!</h2>
|
||||
<h3>Last 10 Logins:</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Last Login Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% loginLogs.forEach(log => { %>
|
||||
<tr>
|
||||
<td><%= log.username %></td>
|
||||
<td><%= new Date(log.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }) %></td>
|
||||
</tr>
|
||||
<% }); %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="logosec">
|
||||
<div class="logo">Eco Saver</div>
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210182541/Untitled-design-(30).png"
|
||||
class="icn menuicn"
|
||||
id="menuicn"
|
||||
alt="menu-icon">
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('sidebarCollapse').addEventListener('click', function () {
|
||||
document.getElementById('sidebar').style.width = (document.getElementById('sidebar').style.width === '250px') ? '0' : '250px';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="searchbar">
|
||||
<input type="text"
|
||||
placeholder="Search">
|
||||
<div class="searchbtn">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210180758/Untitled-design-(28).png"
|
||||
class="icn srchicn"
|
||||
alt="search-icon">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="message">
|
||||
<div class="circle"></div>
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183322/8.png"
|
||||
class="icn"
|
||||
alt="">
|
||||
<div class="dp">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210180014/profile-removebg-preview.png"
|
||||
class="dpicn"
|
||||
alt="dp">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
<div class="main-container">
|
||||
<div class="navcontainer">
|
||||
<nav class="nav">
|
||||
<div class="nav-upper-options">
|
||||
<div class="nav-option option1">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210182148/Untitled-design-(29).png"
|
||||
class="nav-img"
|
||||
alt="dashboard">
|
||||
<h3> Dashboard</h3>
|
||||
</div>
|
||||
|
||||
<div class="option2 nav-option">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183322/9.png"
|
||||
class="nav-img"
|
||||
alt="articles">
|
||||
<h3> Articles</h3>
|
||||
</div>
|
||||
|
||||
<div class="nav-option option3">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183320/5.png"
|
||||
class="nav-img"
|
||||
alt="report">
|
||||
<h3> Report</h3>
|
||||
</div>
|
||||
|
||||
<div class="nav-option option4">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183321/6.png"
|
||||
class="nav-img"
|
||||
alt="institution">
|
||||
<h3> Institution</h3>
|
||||
</div>
|
||||
|
||||
<div class="nav-option option5">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183323/10.png"
|
||||
class="nav-img"
|
||||
alt="blog">
|
||||
<h3> Profile</h3>
|
||||
</div>
|
||||
|
||||
<div class="nav-option option6">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183320/4.png"
|
||||
class="nav-img"
|
||||
alt="settings">
|
||||
<h3> Settings</h3>
|
||||
</div>
|
||||
|
||||
<div class="nav-option logout">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210183321/7.png"
|
||||
class="nav-img"
|
||||
alt="logout">
|
||||
<h3>Logout</h3>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="main">
|
||||
|
||||
<div class="searchbar2">
|
||||
<input type="text"
|
||||
name=""
|
||||
id=""
|
||||
placeholder="Search">
|
||||
<div class="searchbtn">
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210180758/Untitled-design-(28).png"
|
||||
class="icn srchicn"
|
||||
alt="search-button">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-container">
|
||||
|
||||
<div class="box box1">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">60.5k</h2>
|
||||
<h2 class="topic">Article Views</h2>
|
||||
</div>
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210184645/Untitled-design-(31).png"
|
||||
alt="Views">
|
||||
</div>
|
||||
|
||||
<div class="box box2">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">150</h2>
|
||||
<h2 class="topic">Likes</h2>
|
||||
</div>
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210185030/14.png"
|
||||
alt="likes">
|
||||
</div>
|
||||
|
||||
<div class="box box3">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">320</h2>
|
||||
<h2 class="topic">Comments</h2>
|
||||
</div>
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210184645/Untitled-design-(32).png"
|
||||
alt="comments">
|
||||
</div>
|
||||
|
||||
<div class="box box4">
|
||||
<div class="text">
|
||||
<h2 class="topic-heading">70</h2>
|
||||
<h2 class="topic">Published</h2>
|
||||
</div>
|
||||
|
||||
<img src=
|
||||
"https://media.geeksforgeeks.org/wp-content/uploads/20221210185029/13.png" alt="published">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="report-container">
|
||||
<div class="report-header">
|
||||
<h1 class="recent-Articles">Recent Articles</h1>
|
||||
<button class="view">View All</button>
|
||||
</div>
|
||||
|
||||
<div class="report-body">
|
||||
<div class="report-topic-heading">
|
||||
<h3 class="t-op">Article</h3>
|
||||
<h3 class="t-op">Views</h3>
|
||||
<h3 class="t-op">Comments</h3>
|
||||
<h3 class="t-op">Status</h3>
|
||||
</div>
|
||||
|
||||
<div class="items">
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 73</h3>
|
||||
<h3 class="t-op-nextlvl">2.9k</h3>
|
||||
<h3 class="t-op-nextlvl">210</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 72</h3>
|
||||
<h3 class="t-op-nextlvl">1.5k</h3>
|
||||
<h3 class="t-op-nextlvl">360</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 71</h3>
|
||||
<h3 class="t-op-nextlvl">1.1k</h3>
|
||||
<h3 class="t-op-nextlvl">150</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 70</h3>
|
||||
<h3 class="t-op-nextlvl">1.2k</h3>
|
||||
<h3 class="t-op-nextlvl">420</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 69</h3>
|
||||
<h3 class="t-op-nextlvl">2.6k</h3>
|
||||
<h3 class="t-op-nextlvl">190</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 68</h3>
|
||||
<h3 class="t-op-nextlvl">1.9k</h3>
|
||||
<h3 class="t-op-nextlvl">390</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 67</h3>
|
||||
<h3 class="t-op-nextlvl">1.2k</h3>
|
||||
<h3 class="t-op-nextlvl">580</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 66</h3>
|
||||
<h3 class="t-op-nextlvl">3.6k</h3>
|
||||
<h3 class="t-op-nextlvl">160</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
<div class="item1">
|
||||
<h3 class="t-op-nextlvl">Article 65</h3>
|
||||
<h3 class="t-op-nextlvl">1.3k</h3>
|
||||
<h3 class="t-op-nextlvl">220</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">Published</h3>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,28 +1,64 @@
|
||||
let menuicn = document.querySelector(".menuicn");
|
||||
let nav = document.querySelector(".navcontainer");
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const mysql = require('mysql');
|
||||
|
||||
menuicn.addEventListener("click", () => {
|
||||
nav.classList.toggle("navclose");
|
||||
})
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Fetch recent user logins from your server
|
||||
fetch('/api/recentUserLogins')
|
||||
.then(response => response.json())
|
||||
.then(userLogins => {
|
||||
// Populate the recent user logins section
|
||||
const itemsContainer = document.querySelector('.items');
|
||||
// Replace with your MySQL connection details
|
||||
const mysqlConfig = {
|
||||
host: process.env.host,
|
||||
user: process.env.user,
|
||||
password: process.env.password,
|
||||
database: process.env.database,
|
||||
timezone: 'Z', // Set the timezone to UTC
|
||||
};
|
||||
|
||||
userLogins.forEach(userLogin => {
|
||||
const item = document.createElement('div');
|
||||
item.classList.add('item1');
|
||||
item.innerHTML = `
|
||||
<h3 class="t-op-nextlvl">${userLogin.username}</h3>
|
||||
<h3 class="t-op-nextlvl">${userLogin.name}</h3>
|
||||
<h3 class="t-op-nextlvl">${userLogin.email}</h3>
|
||||
<h3 class="t-op-nextlvl label-tag">${userLogin.lastLogin}</h3>
|
||||
`;
|
||||
itemsContainer.appendChild(item);
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error fetching recent user logins:', error));
|
||||
const mysqlConnection = mysql.createConnection(mysqlConfig);
|
||||
|
||||
// Middleware to check if the user is authenticated
|
||||
function isAuthenticated(req, res, next) {
|
||||
if (req.session && req.session.authenticated) {
|
||||
return next();
|
||||
} else {
|
||||
res.redirect('/login');
|
||||
}
|
||||
}
|
||||
|
||||
// InUsers route (renders the InUsers tab)
|
||||
router.get('/', isAuthenticated, (req, res) => {
|
||||
// Fetch all user data from the database
|
||||
const userDataQuery = 'SELECT * FROM users';
|
||||
|
||||
mysqlConnection.query(userDataQuery, (error, userData) => {
|
||||
if (error) {
|
||||
console.error('Error fetching user data:', error);
|
||||
res.status(500).send('Internal Server Error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Render the inusers page with user data
|
||||
res.render('inusers', { userData: userData });
|
||||
});
|
||||
});
|
||||
|
||||
// User Data route
|
||||
router.get('/userdata', isAuthenticated, (req, res) => {
|
||||
// Fetch all user data from the database
|
||||
const userDataQuery = 'SELECT * FROM users';
|
||||
|
||||
mysqlConnection.query(userDataQuery, (error, userData) => {
|
||||
if (error) {
|
||||
console.error('Error fetching user data:', error);
|
||||
res.status(500).send('Internal Server Error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Render the user-data page with user data
|
||||
res.render('user-data', { userData: userData });
|
||||
});
|
||||
});
|
||||
|
||||
// Edit User Data route
|
||||
router.get('/edituserdata', isAuthenticated, (req, res) => {
|
||||
res.render('edit-user-data');
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
208
Sean/views/inusers.ejs
Normal file
208
Sean/views/inusers.ejs
Normal file
@ -0,0 +1,208 @@
|
||||
<!-- views/inusers.ejs -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>In-House Users</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Arial', sans-serif;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
height: 100%;
|
||||
width: 250px;
|
||||
position: fixed;
|
||||
background-color: #333;
|
||||
padding-top: 60px;
|
||||
transition: 0.5s;
|
||||
}
|
||||
|
||||
#sidebar img {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#sidebar a {
|
||||
padding: 10px 15px;
|
||||
text-decoration: none;
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
display: block;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#sidebar a:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 250px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
#sidebar {
|
||||
width: 0;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#sidebarCollapse {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#sidebarCollapse span {
|
||||
display: block;
|
||||
background: white;
|
||||
height: 5px;
|
||||
width: 30px;
|
||||
margin: 6px auto;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#sidebarCollapse:hover span:nth-child(1) {
|
||||
transform: rotate(-45deg) translate(-5px, 6px);
|
||||
}
|
||||
|
||||
#sidebarCollapse:hover span:nth-child(2) {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#sidebarCollapse:hover span:nth-child(3) {
|
||||
transform: rotate(45deg) translate(-5px, -6px);
|
||||
}
|
||||
|
||||
/* Add additional styles specific to inusers.ejs below */
|
||||
#userDataContainer {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #dddddd;
|
||||
text-align: left;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="sidebar">
|
||||
<img src="LOGO.PNG" alt="Custom Image">
|
||||
<div id="sidebarCollapse">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
<a href="#" id="userDataLink">User Data</a>
|
||||
<a href="/inusers/edituserdata">Edit User Data</a>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h2>Welcome to the In-House Users Page</h2>
|
||||
|
||||
<div id="userDataContainer">
|
||||
<h3>All Users</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Password</th>
|
||||
<th>Last Login</th>
|
||||
<th>Job Title</th>
|
||||
<!-- Add more table headers as needed -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if (allUsers && allUsers.length > 0) { %>
|
||||
<% allUsers.forEach(user => { %>
|
||||
<tr>
|
||||
<td><%= user.name %></td>
|
||||
<td><%= user.username %></td>
|
||||
<td><%= user.email %></td>
|
||||
<td><%= user.password %></td>
|
||||
<td><%= new Date(user.lastLogin).toLocaleString('en-US', { timeZone: 'Asia/Singapore' }) %></td>
|
||||
<td><%= user.jobTitle %></td>
|
||||
<!-- Add more table data cells as needed -->
|
||||
</tr>
|
||||
<% }); %>
|
||||
<% } else { %>
|
||||
<tr>
|
||||
<td colspan="6">No users available.</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Additional content for In-House Users page goes here -->
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
||||
<script>
|
||||
document.getElementById('sidebarCollapse').addEventListener('click', function () {
|
||||
document.getElementById('sidebar').style.width = (document.getElementById('sidebar').style.width === '250px') ? '0' : '250px';
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
function displayUserData() {
|
||||
$.ajax({
|
||||
url: '/inusers/userdata',
|
||||
method: 'GET',
|
||||
dataType: 'html',
|
||||
success: function (data) {
|
||||
$('#userDataContainer').html(data);
|
||||
},
|
||||
error: function (error) {
|
||||
console.error('Error fetching user data:', error);
|
||||
// Handle error as needed
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Call the function when the page loads
|
||||
displayUserData();
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
291
package-lock.json
generated
291
package-lock.json
generated
@ -61,16 +61,39 @@
|
||||
"negotiator": "0.6.3"
|
||||
}
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
||||
},
|
||||
"async": {
|
||||
"version": "3.2.5",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz",
|
||||
"integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg=="
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bignumber.js": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
|
||||
},
|
||||
"bl": {
|
||||
"version": "6.0.9",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-6.0.9.tgz",
|
||||
@ -82,12 +105,12 @@
|
||||
}
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.20.1",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
||||
"integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
|
||||
"version": "1.20.2",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
|
||||
"integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
|
||||
"requires": {
|
||||
"bytes": "3.1.2",
|
||||
"content-type": "~1.0.4",
|
||||
"content-type": "~1.0.5",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
@ -95,7 +118,7 @@
|
||||
"iconv-lite": "0.4.24",
|
||||
"on-finished": "2.4.1",
|
||||
"qs": "6.11.0",
|
||||
"raw-body": "2.5.1",
|
||||
"raw-body": "2.5.2",
|
||||
"type-is": "~1.6.18",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
@ -115,6 +138,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
|
||||
@ -144,6 +175,15 @@
|
||||
"resolved": "https://registry.npmjs.org/capitalize/-/capitalize-2.0.4.tgz",
|
||||
"integrity": "sha512-wcSyiFqXRYyCoqu0o0ekXzJAKCLMkqWS5QWGlgTJFJKwRmI6pzcN2hBl5VPq9RzLW5Uf4FF/V/lcFfjCtVak2w=="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"coap": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/coap/-/coap-1.3.0.tgz",
|
||||
@ -165,6 +205,24 @@
|
||||
"resolved": "https://registry.npmjs.org/coap-packet/-/coap-packet-1.1.1.tgz",
|
||||
"integrity": "sha512-Bkz2ZKI/7hU2gm6nUuo5l+MBSkdFJx7My1ZgNEhKUC7K2yYfQYVbBPRa64BBYLcEcYgaSlau4A1Uw5xfM2I0zw=="
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
@ -195,6 +253,11 @@
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
@ -243,6 +306,14 @@
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"ejs": {
|
||||
"version": "3.1.9",
|
||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz",
|
||||
"integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==",
|
||||
"requires": {
|
||||
"jake": "^10.8.5"
|
||||
}
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
@ -306,6 +377,76 @@
|
||||
"vary": "~1.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": {
|
||||
"version": "1.20.1",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
||||
"integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
|
||||
"requires": {
|
||||
"bytes": "3.1.2",
|
||||
"content-type": "~1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"http-errors": "2.0.0",
|
||||
"iconv-lite": "0.4.24",
|
||||
"on-finished": "2.4.1",
|
||||
"qs": "6.11.0",
|
||||
"raw-body": "2.5.1",
|
||||
"type-is": "~1.6.18",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
|
||||
"integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
|
||||
"requires": {
|
||||
"bytes": "3.1.2",
|
||||
"http-errors": "2.0.0",
|
||||
"iconv-lite": "0.4.24",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"express-session": {
|
||||
"version": "1.17.3",
|
||||
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
|
||||
"integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==",
|
||||
"requires": {
|
||||
"cookie": "0.4.2",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~2.0.0",
|
||||
"on-headers": "~1.0.2",
|
||||
"parseurl": "~1.3.3",
|
||||
"safe-buffer": "5.2.1",
|
||||
"uid-safe": "~2.1.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"cookie": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
|
||||
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
@ -331,6 +472,24 @@
|
||||
"resolved": "https://registry.npmjs.org/fastseries/-/fastseries-2.0.0.tgz",
|
||||
"integrity": "sha512-XBU9RXeoYc2/VnvMhplAxEmZLfIk7cvTBu+xwoBuTI8pL19E03cmca17QQycKIdxgwCeFA/a4u27gv1h3ya5LQ=="
|
||||
},
|
||||
"filelist": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
|
||||
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
|
||||
"requires": {
|
||||
"minimatch": "^5.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimatch": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
|
||||
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
|
||||
"requires": {
|
||||
"brace-expansion": "^2.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
|
||||
@ -402,6 +561,11 @@
|
||||
"get-intrinsic": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
||||
},
|
||||
"has-property-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz",
|
||||
@ -473,6 +637,22 @@
|
||||
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
|
||||
"integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g=="
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
|
||||
},
|
||||
"jake": {
|
||||
"version": "10.8.7",
|
||||
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
|
||||
"integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==",
|
||||
"requires": {
|
||||
"async": "^3.2.3",
|
||||
"chalk": "^4.0.2",
|
||||
"filelist": "^1.0.4",
|
||||
"minimatch": "^3.1.2"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
@ -524,6 +704,25 @@
|
||||
"mime-db": "1.52.0"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
@ -542,6 +741,46 @@
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"mysql": {
|
||||
"version": "2.18.1",
|
||||
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
|
||||
"integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==",
|
||||
"requires": {
|
||||
"bignumber.js": "9.0.0",
|
||||
"readable-stream": "2.3.7",
|
||||
"safe-buffer": "5.1.2",
|
||||
"sqlstring": "2.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"sqlstring": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
||||
"integrity": "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ=="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mysql2": {
|
||||
"version": "3.6.5",
|
||||
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.6.5.tgz",
|
||||
@ -605,6 +844,11 @@
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"on-headers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
|
||||
"integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA=="
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
@ -625,6 +869,11 @@
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
@ -642,15 +891,20 @@
|
||||
"side-channel": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"random-bytes": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
|
||||
"integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ=="
|
||||
},
|
||||
"range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
|
||||
"integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
|
||||
"integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
|
||||
"requires": {
|
||||
"bytes": "3.1.2",
|
||||
"http-errors": "2.0.0",
|
||||
@ -830,6 +1084,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
@ -849,6 +1111,14 @@
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"uid-safe": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
|
||||
"integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
|
||||
"requires": {
|
||||
"random-bytes": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
@ -859,6 +1129,11 @@
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
|
@ -17,9 +17,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/Newtbot/MP#readme",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.20.2",
|
||||
"coap": "^1.3.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"ejs": "^3.1.9",
|
||||
"express": "^4.18.2",
|
||||
"express-session": "^1.17.3",
|
||||
"mysql": "^2.18.1",
|
||||
"mysql2": "^3.6.5",
|
||||
"sequelize": "^6.35.2"
|
||||
}
|
||||
|
Reference in New Issue
Block a user