couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1094077 - /couchdb/branches/1.1.x/share/www/script/jquery.couch.js
Date Sat, 16 Apr 2011 22:38:07 GMT
Author: jan
Date: Sat Apr 16 22:38:06 2011
New Revision: 1094077

URL: http://svn.apache.org/viewvc?rev=1094077&view=rev
Log:
Make prepareUserDoc a public method.

Closes COUCHDB-1014

Patch by Benjamin Young.

Modified:
    couchdb/branches/1.1.x/share/www/script/jquery.couch.js

Modified: couchdb/branches/1.1.x/share/www/script/jquery.couch.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/share/www/script/jquery.couch.js?rev=1094077&r1=1094076&r2=1094077&view=diff
==============================================================================
--- couchdb/branches/1.1.x/share/www/script/jquery.couch.js [utf-8] (original)
+++ couchdb/branches/1.1.x/share/www/script/jquery.couch.js [utf-8] Sat Apr 16 22:38:06 2011
@@ -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({



Mime
View raw message