summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2011-04-16 22:38:06 +0000
committerJan Lehnardt <jan@apache.org>2011-04-16 22:38:06 +0000
commit235dfd0ece6c6d4ab95ee0dfdc1a7083506cf413 (patch)
tree099a86afbdd51ac943895c74e61dc98a3e435124 /share/www
parent9101d43b0f1e3d7f6ea902d8b52beaa0e539f8f1 (diff)
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
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/jquery.couch.js40
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({