Open finnp opened 8 years ago
Okay, I thought this was an issue with the library/CLI. But now it seems like it's an issue of the registry. Maybe someone can help me figure this out.
If I remove the email
from the request. The login will still work, but the signup will fail. So it would actually be possible to separate those.
Here's the code I use for login:
var userobj = {
_id: 'org.couchdb.user:' + username,
name: username,
password: password,
type: 'user',
roles: [],
date: new Date().toISOString()
}
var uri = url.resolve(registry, '-/user/org.couchdb.user:' + encodeURIComponent(username))
var options = {
method: 'PUT',
body: userobj
}
client.request(uri, options, function (error, data, json, response) {
if (error) return cb(error)
if (!data.token) return cb(new Error('No token returned.'))
cb(null, data.token)
})
Hey :)
I would like to use the client to login, but I don't want accidental accounts creations (see https://github.com/npm/npm/issues/8337).
I was thinking of factoring out the
login
part and (potentially using it withinadduser
). So thatadduser
would stay the same, but login would not create an account.What do you think? I could start a PR for this.