couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [41/50] jquery-couch commit: updated refs/heads/import-master to 66dbcbf
Date Tue, 01 Apr 2014 08:52:46 GMT
Fix admin users creation and user password change in futon.

main patch from jan, reviewed & updated by me.


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/428e8742
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/tree/428e8742
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/diff/428e8742

Branch: refs/heads/import-master
Commit: 428e874206c90db67f297fb66d6ed38e06c54fc9
Parents: 2b95f33
Author: benoitc <bchesneau@gmail.com>
Authored: Sat Dec 3 06:13:34 2011 +0100
Committer: Alexander Shorin <kxepal@gmail.com>
Committed: Sat Dec 3 06:13:34 2011 +0100

----------------------------------------------------------------------
 jquery.couch.js | 32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/blob/428e8742/jquery.couch.js
----------------------------------------------------------------------
diff --git a/jquery.couch.js b/jquery.couch.js
index eecd359..b3a24f0 100644
--- a/jquery.couch.js
+++ b/jquery.couch.js
@@ -182,38 +182,18 @@
      */
     signup: function(user_doc, password, options) {
       options = options || {};
-      // prepare user doc based on name and password
-      user_doc = this.prepareUserDoc(user_doc, password);
+      user_doc.password = password;
+      user_doc.roles =  user_doc.roles || [];
+      user_doc.type =  user_doc.type = "user" || [];
+      var user_prefix = "org.couchdb.user:";
+      user_doc._id = user_doc._id || user_prefix + user_doc.name;
+
       $.couch.userDb(function(db) {
         db.saveDoc(user_doc, options);
       });
     },
 
     /**
-     * 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