Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 19272105EF for ; Tue, 1 Apr 2014 08:53:44 +0000 (UTC) Received: (qmail 22520 invoked by uid 500); 1 Apr 2014 08:52:38 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 22216 invoked by uid 500); 1 Apr 2014 08:52:28 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 21359 invoked by uid 99); 1 Apr 2014 08:52:09 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2014 08:52:09 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7268C91B20B; Tue, 1 Apr 2014 08:52:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kxepal@apache.org To: commits@couchdb.apache.org Date: Tue, 01 Apr 2014 08:52:46 -0000 Message-Id: <8d3b21ae58ab4a49be02b21106d554a4@git.apache.org> In-Reply-To: <9b1fa52a5b7c4e23a6ef348e7963b27c@git.apache.org> References: <9b1fa52a5b7c4e23a6ef348e7963b27c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [41/50] jquery-couch commit: updated refs/heads/import-master to 66dbcbf 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 Authored: Sat Dec 3 06:13:34 2011 +0100 Committer: Alexander Shorin 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 options parameter is *expected to have name and password fields. * @param {ajaxSettings} options