diff options
-rw-r--r-- | share/www/script/jquery.couch.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index f3b78189..77d1b551 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -22,25 +22,6 @@ return encodeURIComponent(docID); }; - function prepareUserDoc(user_doc, new_password) { - if (typeof hex_sha1 == "undefined") { - alert("creating a user doc requires sha1.js to be loaded in the page"); - return; - } - var user_prefix = "org.couchdb.user:"; - user_doc._id = user_doc._id || user_prefix + user_doc.name; - if (new_password) { - // handle the password crypto - user_doc.salt = $.couch.newUUID(); - user_doc.password_sha = hex_sha1(new_password + user_doc.salt); - } - user_doc.type = "user"; - if (!user_doc.roles) { - user_doc.roles = []; - } - return user_doc; - }; - var uuidCache = []; $.extend($.couch, { @@ -120,7 +101,26 @@ db.saveDoc(user_doc, options); }); }, - + + prepareUserDoc: function(user_doc, new_password) { + if (typeof hex_sha1 == "undefined") { + alert("creating a user doc requires sha1.js to be loaded in the page"); + return; + } + var user_prefix = "org.couchdb.user:"; + user_doc._id = user_doc._id || user_prefix + user_doc.name; + if (new_password) { + // handle the password crypto + user_doc.salt = $.couch.newUUID(); + user_doc.password_sha = hex_sha1(new_password + user_doc.salt); + } + user_doc.type = "user"; + if (!user_doc.roles) { + user_doc.roles = []; + } + return user_doc; + } + login: function(options) { options = options || {}; $.ajax({ |