13

I am using jquery.couch.js to do signup/login/logout to a CouchDB _users database in my Sproutcore application. Is anyone aware of a method for changing user _id and password?

2 Answers 2

24

As far as I know the user id cannot be changed but the password can.

The CouchDB documentation describes the process of changing a user password in detail, short:

  • Get the org.couchdb.user:<myuser> document

  • Add a password field with the plaintext password

  • Store the document back to the _users database

As soon as the document is in the database, the CouchDB rehashes the plaintext password using PBKDF2 (at least since CouchDB 1.3).

Sign up to request clarification or add additional context in comments.

Comments

7

Unfortunately, there is no built-in API to do this. The best thing for now is to read the jquery.couch.js code for account creation and use the same code or algorithms to do account modification.

Specifically, you need to update the password_sha and salt values to change a password. To change a user name, you must make a new document, then delete the old document. Just keep the _id and name values in sync and you'll be okay.

1 Comment

Thanks for the tip. I suspected that creating a new user/deleting the old would be the way to go if there wasn't a modification api. I'll give it a try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.