Browse Source

Fix "user not defined"

pull/6/head
Menci 8 years ago
parent
commit
a1a845d20b
  1. 4
      app.js

4
app.js

@ -111,14 +111,16 @@ global.syzoj = {
let User = syzoj.model('user'); let User = syzoj.model('user');
User.fromID(req.session.user_id).then((user) => { User.fromID(req.session.user_id).then((user) => {
res.locals.user = user; res.locals.user = user;
next();
}).catch((err) => { }).catch((err) => {
this.log(err); this.log(err);
res.locals.user = req.session.user_id = null; res.locals.user = req.session.user_id = null;
next();
}) })
} else { } else {
res.locals.user = req.session.user_id = null; res.locals.user = req.session.user_id = null;
next();
} }
next();
}); });
// Active item on navigator bar // Active item on navigator bar

Loading…
Cancel
Save