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