If you're interested, take a look at the latest Hoodie project on .
This project features an API designed for managing CouchDb user accounts. Here are some of the functions available:
// sign up
hoodie.account.signUp('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="375d585277524f565a475b521954585a">[email protected]</a>', 'secret');
// sign in
hoodie.account.signIn('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bed4d1dbfedbc6dfd3ced2db90ddd1d3">[email protected]</a>', 'secret');
// sign out
hoodie.account.signOut();
// change password
hoodie.account.changePassword('currentpassword', 'newpassword');
// change username
hoodie.account.changeUsername('currentpassword', 'newusername');
// reset password
hoodie.account.resetPassword('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90fafff5d0f5e8f1fde0fcf5bef3fffd">[email protected]</a>');
// destroy account and all its data
hoodie.account.destroy();
// find out who the currently logged in user is (returns undefined if none)
hoodie.account.username;
Additionally, there are events that can be triggered:
// user has signed up (this also triggers the authenticated event, see below)
hoodie.account.on('signup', function (user) {});
// user has signed in (this also triggers the authenticated event, see below)
hoodie.account.on('signin', function (user) {});
// user has signed out
hoodie.account.on('signout', function (user) {});
// user has re-authenticated after their session timed out (this does _not_ trigger the signin event)
hoodie.account.on('authenticated', function (user) {});
// user's session has timed out. This means the user is still signed in locally, but Hoodie cannot sync remotely, so the user must sign in again
hoodie.account.on('unauthenticated', function (user) {});