|
|
@ -170,7 +170,8 @@ global.syzoj = { |
|
|
|
app.use(Session(sessionConfig)); |
|
|
|
app.use(Session(sessionConfig)); |
|
|
|
|
|
|
|
|
|
|
|
app.use((req, res, next) => { |
|
|
|
app.use((req, res, next) => { |
|
|
|
// req.session.user_id = 1;
|
|
|
|
res.locals.useLocalLibs = !!req.headers['syzoj-no-cdn']; |
|
|
|
|
|
|
|
|
|
|
|
let User = syzoj.model('user'); |
|
|
|
let User = syzoj.model('user'); |
|
|
|
if (req.session.user_id) { |
|
|
|
if (req.session.user_id) { |
|
|
|
User.fromID(req.session.user_id).then((user) => { |
|
|
|
User.fromID(req.session.user_id).then((user) => { |
|
|
@ -181,7 +182,7 @@ global.syzoj = { |
|
|
|
res.locals.user = null; |
|
|
|
res.locals.user = null; |
|
|
|
req.session.user_id = null; |
|
|
|
req.session.user_id = null; |
|
|
|
next(); |
|
|
|
next(); |
|
|
|
}) |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (req.cookies.login) { |
|
|
|
if (req.cookies.login) { |
|
|
|
let obj; |
|
|
|
let obj; |
|
|
|