mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
change 403 error with 409 in adduser
Because npm does only accept 409, see #184.
This commit is contained in:
parent
c49b0699c2
commit
79e2ff2ee8
1 changed files with 5 additions and 4 deletions
|
@ -136,10 +136,11 @@ module.exports = function(config, auth, storage) {
|
|||
}
|
||||
auth.add_user(req.body.name, req.body.password, function(err, user) {
|
||||
if (err) {
|
||||
if (err.status < 500 && err.message === 'this user already exists') {
|
||||
// with npm registering is the same as logging in
|
||||
// so we replace message in case of conflict
|
||||
return next( Error[409]('bad username/password, access denied') )
|
||||
if (err.status >= 400 && err.status < 500) {
|
||||
// With npm registering is the same as logging in,
|
||||
// and npm accepts only an 409 error.
|
||||
// So, changing status code here.
|
||||
return next( Error[409](err.message) )
|
||||
}
|
||||
return next(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue