pouchdb / pouchdb-auth

A PouchDB plug-in that simulates CouchDB's authentication daemon. Includes a users db that functions like CouchDB's.
36 stars 11 forks source link

Change Password #10

Closed samhcorney closed 8 years ago

samhcorney commented 8 years ago

Hey,

Great plugin btw!

Is it possible to change passwords once set?

Sam

marten-de-vries commented 8 years ago

Yes, it works exactly the same as for CouchDB, you just update the document. IIRC something like this should work (semi-pseudocode)

// assuming db is a database you can also call login() etc. on
db.get('org.couchdb.user:username').then(function (resp) {// or whatever the exact id is
  resp.password = 'new-password';
  return db.put(resp);
});

If you look at the source, you'll see that the sign up function is actually just a tiny wrapper that also just inserts a document.

samhcorney commented 8 years ago

@marten-de-vries perfect thanks for the help!