-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,10 +206,27 @@ module.exports = function(config_hash) { | |
}) | ||
|
||
app.put('/-/user/:org_couchdb_user', function(req, res, next) { | ||
res.status(409) | ||
return res.send({ | ||
error: 'registration is not implemented', | ||
}) | ||
if (req.remoteUser != null) { | ||
res.status(200) | ||
return res.send({ | ||
ok: 'you are authenticated as "' + req.remoteUser + '"', | ||
}) | ||
} else { | ||
if (typeof(req.body.name) !== 'string' || typeof(req.body.password) !== 'string') { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rlidwka
Author
Owner
|
||
res.status(409) | ||
return res.send({ | ||
ok: 'user/password is not found in request (npm issue?)', | ||
}) | ||
} | ||
config.add_user(req.body.name, req.body.password, function(err) { | ||
if (err) return next(err) | ||
|
||
res.status(201) | ||
return res.send({ | ||
ok: 'user "' + req.remoteUser + '" created', | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
app.put('/-/user/:org_couchdb_user/-rev/*', function(req, res, next) { | ||
|
client side code:
npm adduser
Username: admin
Password: 1234qwer
Email: [email protected]
print a log:
console.log(req.body.password, typeof(req.body.password)); => undefined, undefined
node version: 0.10.24
npm version: 1.3.21
Thank you for your code.
Please check this error.