0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

better error message, ref #9

This commit is contained in:
Alex Kocharin 2013-10-05 18:49:08 +04:00
parent 57dc1c64d9
commit bffc6db38f

View file

@ -19,10 +19,17 @@ module.exports = function(config_hash) {
if (config['allow_'+action](req.params.package, req.remoteUser)) {
next();
} else {
next(new UError({
status: 403,
msg: 'user '+req.remoteUser+' not allowed to '+action+' it'
}));
if (req.remoteUser === 'anonymous') {
next(new UError({
status: 403,
msg: "can't "+action+" restricted package without auth, did you forget 'npm set always-auth true'?",
}));
} else {
next(new UError({
status: 403,
msg: 'user '+req.remoteUser+' not allowed to '+action+' it'
}));
}
}
};
};