|
|
@@ -182,7 +182,9 @@ exports.swigFilters = function(app, swig) {
|
|
|
|
|
|
exports.adminRequired = function() {
|
|
|
return function(req, res, next) {
|
|
|
- if (req.user && '_id' in req.user) {
|
|
|
+ // check the user logged in
|
|
|
+ // make sure that req.user isn't username/email string to login which is set by basic-auth-connect
|
|
|
+ if (req.user != null && (req.user instanceof Object) && '_id' in req.user) {
|
|
|
if (req.user.admin) {
|
|
|
next();
|
|
|
return;
|
|
|
@@ -215,7 +217,9 @@ exports.loginRequired = function(crowi, app, isStrictly = true) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (req.user && '_id' in req.user) {
|
|
|
+ // check the user logged in
|
|
|
+ // make sure that req.user isn't username/email string to login which is set by basic-auth-connect
|
|
|
+ if (req.user != null && (req.user instanceof Object) && '_id' in req.user) {
|
|
|
if (req.user.status === User.STATUS_ACTIVE) {
|
|
|
// Active の人だけ先に進める
|
|
|
return next();
|