From 235dfd0ece6c6d4ab95ee0dfdc1a7083506cf413 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sat, 16 Apr 2011 22:38:06 +0000 Subject: Make prepareUserDoc a public method. Closes COUCHDB-1014 Patch by Benjamin Young. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1094077 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/jquery.couch.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'share/www/script/jquery.couch.js') 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({ -- cgit v1.2.3