Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Could not login with existing user. #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henkosch
Copy link

PUT /-/user/:org_couchdb_user should login with existing user when password matches the username, added auth.authenticate call before auth.add_user.

Login with existing user did not work:
#329

But the expected behavior is to log in the user in the first PUT request.
See this fiddler request log taken from registry.npmjs.org:

Request:

PUT http://registry.npmjs.org/-/user/org.couchdb.user:test HTTP/1.1
accept-encoding: gzip
version: 2.14.4
accept: application/json
referer: adduser
npm-session: ***
user-agent: npm/2.14.4 node/v4.1.1 win32 x64
host: registry.npmjs.org
content-type: application/json
content-length: 156
Connection: keep-alive

{"_id":"org.couchdb.user:test","name":"test","password":"abc","email":"email@test.com","type":"user","roles":[],"date":"2015-10-23T20:33:54.862Z"}

Response: (registry.npmjs.org)

HTTP/1.1 201 Created
Content-Type: application/json
Cache-Control: max-age=60
Content-Length: 127
Accept-Ranges: bytes
Date: Fri, 23 Oct 2015 20:33:56 GMT
Via: 1.1 varnish
Connection: keep-alive
X-Served-By: cache-fra1227-FRA
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1445632435.244664,VS0,VE781

{"ok":true,"id":"org.couchdb.user:undefined","rev":"_we_dont_use_revs_any_more","token":"xyz"}

So as you can see the first PUT request should respond with 201 Created to log in the existing user.

…ser should login with existing user when password matches the username, added auth.authenticate call before auth.add_user.
@mcansky
Copy link

mcansky commented Dec 7, 2015

@henkosch might be a good idea to add logging for the case where there is an error, or at least return something such as the err value as the current state does not explain much what's happening.

} else {
  return next( error[401](err.message) )
}

@mcansky
Copy link

mcansky commented Dec 7, 2015

I also had trouble using a custom fork as the package.json is replaced by a package.yaml ...

jamietre added a commit to jamietre/sinopia that referenced this pull request Dec 8, 2015
jamietre added a commit to jamietre/sinopia that referenced this pull request Dec 8, 2015
gaelreyrol pushed a commit to Soyhuce/cinabre that referenced this pull request May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants