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:
parent
57dc1c64d9
commit
bffc6db38f
1 changed files with 11 additions and 4 deletions
15
lib/index.js
15
lib/index.js
|
@ -19,10 +19,17 @@ module.exports = function(config_hash) {
|
||||||
if (config['allow_'+action](req.params.package, req.remoteUser)) {
|
if (config['allow_'+action](req.params.package, req.remoteUser)) {
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
next(new UError({
|
if (req.remoteUser === 'anonymous') {
|
||||||
status: 403,
|
next(new UError({
|
||||||
msg: 'user '+req.remoteUser+' not allowed to '+action+' it'
|
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'
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue