couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [35/50] jquery-couch commit: updated refs/heads/import-master to 66dbcbf
Date Tue, 01 Apr 2014 08:52:40 GMT
Make prepareUserDoc a public method.

Closes COUCHDB-1014

Patch by Benjamin Young.

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1094076 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/commit/b4f2197f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/tree/b4f2197f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/diff/b4f2197f

Branch: refs/heads/import-master
Commit: b4f2197fc4e5126d5b72a1847ab80d508d0f999c
Parents: 3b01c58
Author: Jan Lehnardt <jan@apache.org>
Authored: Sat Apr 16 22:36:36 2011 +0000
Committer: Alexander Shorin <kxepal@gmail.com>
Committed: Sat Apr 16 22:36:36 2011 +0000

----------------------------------------------------------------------
 jquery.couch.js | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/blob/b4f2197f/jquery.couch.js
----------------------------------------------------------------------
diff --git a/jquery.couch.js b/jquery.couch.js
index f4c609b..ab1f865 100644
--- a/jquery.couch.js
+++ b/jquery.couch.js
@@ -54,24 +54,6 @@
   /**
    * @private
    */
-  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 = [];
 
@@ -208,6 +190,30 @@
     },
 
     /**
+     * Populates a user doc with a new password.
+     * @param {Object} user_doc User details
+     * @param {String} new_password New Password
+     */
+    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;
+    }
+
+    /**
      * Authenticate against CouchDB, the <code>options</code> parameter is
       *expected to have <code>name</code> and <code>password</code>
fields.
      * @param {ajaxSettings} options


Mime
View raw message