settingsv1
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import sql from "../../inc/sql.mjs";
|
||||
|
||||
const auth = async (req, res, next) => {
|
||||
if(!req.session)
|
||||
return res.redirect("/login");
|
||||
@ -6,8 +8,17 @@ const auth = async (req, res, next) => {
|
||||
|
||||
export default (router, tpl) => {
|
||||
router.group(/^\/settings/, group => {
|
||||
group.get(/$/, auth, (req, res) => {
|
||||
res.end("settings lol");
|
||||
group.get(/$/, auth, async (req, res) => {
|
||||
const sessions = await sql("user_sessions")
|
||||
.where("user_id", req.session.id)
|
||||
.orderBy("last_used", "desc");
|
||||
|
||||
res.reply({
|
||||
body: tpl.render('settings', {
|
||||
tmp: null,
|
||||
sessions
|
||||
}, req)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user