fix/session check fixed
This commit is contained in:
1 parent
fef7184404
commit
f39b8555fa
2 files changed
+6
-4
No files matched your search
@@ -65,10 +65,6 @@ app.get('/aboutUs', (req, res) => {
|
|||||||
return res.status(status.Ok);
|
return res.status(status.Ok);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/logout', (req, res) => {
|
|
||||||
req.session.destroy();
|
|
||||||
return res.redirect('/login');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initialize database and start app
|
// Initialize database and start app
|
||||||
initDatabase().then(() => {
|
initDatabase().then(() => {
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ module.exports = (users) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.post("/login", async (req, res) => {
|
router.post("/login", async (req, res) => {
|
||||||
|
|
||||||
|
if (req.session.authenticated) {
|
||||||
|
res.redirect("/home");
|
||||||
|
return res.status(status.Ok);
|
||||||
|
}
|
||||||
|
|
||||||
const credentialSchema = joi.object({
|
const credentialSchema = joi.object({
|
||||||
email: joi.string().email().required(),
|
email: joi.string().email().required(),
|
||||||
password: joi.string().max(20).required(),
|
password: joi.string().max(20).required(),
|
||||||
|
|||||||
Reference in new issue
Block a user