Changing the username and password in the CouchDB _user database

I am using jquery.couch.js to register / enter / exit the CouchDB _users database in my Sproutcore application. Does anyone know of a method for changing user _id and password?

+7
source share
2 answers

Unfortunately, there is no built-in API for this. At the moment, it is best to read the jquery.couch.js code to create an account and use the same code or algorithms to modify the account.

In particular, you need to update the password_sha and salt values ​​to change the password. To change the username, you must create a new document and then delete the old document. Just keep the _id and name values ​​in sync and everything will be fine.

+5
source

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

The CouchDB documentation describes how to change a user's password in detail:

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

  • Add plain text password field

  • Save the document in the _users database

Once the document is in the database, CouchDB rephrases the plaintext password using PBKDF2 (at least with CouchDB 1.3).

+11
source

All Articles