2022-03-21 23:53:22 +03:00
|
|
|
const { Router } = require("express")
|
|
|
|
|
|
|
|
const app = Router();
|
|
|
|
|
2022-04-06 21:14:46 +03:00
|
|
|
app.get("/", async (req, res) => {
|
2022-08-11 03:48:35 +03:00
|
|
|
if (!req.session.userid) return res.redirect('/login');
|
|
|
|
|
2022-04-06 21:14:46 +03:00
|
|
|
const user = req.user;
|
2022-03-21 23:53:22 +03:00
|
|
|
|
2022-08-11 03:48:35 +03:00
|
|
|
if (!user?.admin) return res.error( 403, "You have not got permissions for view to this page.");
|
2022-03-21 23:53:22 +03:00
|
|
|
|
2022-08-27 10:31:16 +03:00
|
|
|
res.reply("admin", { user2: false })
|
2022-04-03 21:01:55 +03:00
|
|
|
});
|
2022-03-21 23:53:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-31 01:01:32 +03:00
|
|
|
module.exports = app;
|