From 31bf6853882f0c383ee3c44e20e0bdceba9750dc Mon Sep 17 00:00:00 2001 From: Wesley Silva Date: Mon, 11 Nov 2024 22:45:29 -0300 Subject: [PATCH] perf(app.js): change the route to before authentication redirect to login form --- app.js | 6 +++++- public/styles/sidebar.css | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index deb79e73..9b8df0de 100644 --- a/app.js +++ b/app.js @@ -64,7 +64,11 @@ app.get('/', requireAuth, (req, res) => { // Become the route fo login to start the application. app.get('*', (req, res) => { - res.redirect('/login') + if (!req.session.authenticated) { + res.redirect('/login') + } else { + res.sendFile(path.join(__dirname, 'public', 'index.html')) + } }) app.listen(port, () => { diff --git a/public/styles/sidebar.css b/public/styles/sidebar.css index 063c7e8c..cd027d7f 100644 --- a/public/styles/sidebar.css +++ b/public/styles/sidebar.css @@ -3,8 +3,8 @@ .sidebar { position: fixed; top: 0; - right: -20%; - width: 20%; + right: -40%; + width: 40%; height: 100%; background-color: #45a049; opacity: 0.9;