summaryrefslogtreecommitdiff
path: root/share/www/script/couch.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-01-18 03:45:54 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-01-18 03:45:54 +0000
commit09351a0535fe9bc3fa780763c095fd6dc56175de (patch)
treebb5940d322a8ed152c1e933c564ca51ed4ae6231 /share/www/script/couch.js
parent0a94f47f2b962048837a6a28449bfd962dd1fd3e (diff)
normalize userCtx name and roles, also, no log in via a conflict doc
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@900275 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r--share/www/script/couch.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js
index 21ea39b3..cb6fab89 100644
--- a/share/www/script/couch.js
+++ b/share/www/script/couch.js
@@ -121,7 +121,7 @@ function CouchDB(name, httpHeaders) {
CouchDB.maybeThrowError(this.last_req);
var results = JSON.parse(this.last_req.responseText);
for (var i = 0; i < docs.length; i++) {
- if(results[i].rev) {
+ if(results[i] && results[i].rev) {
docs[i]._rev = results[i].rev;
}
}
@@ -322,11 +322,11 @@ function CouchDB(name, httpHeaders) {
// Use this from callers to check HTTP status or header values of requests.
CouchDB.last_req = null;
-CouchDB.login = function(username, password) {
+CouchDB.login = function(name, password) {
CouchDB.last_req = CouchDB.request("POST", "/_session", {
headers: {"Content-Type": "application/x-www-form-urlencoded",
"X-CouchDB-WWW-Authenticate": "Cookie"},
- body: "username=" + encodeURIComponent(username) + "&password="
+ body: "name=" + encodeURIComponent(name) + "&password="
+ encodeURIComponent(password)
});
return JSON.parse(CouchDB.last_req.responseText);
@@ -350,7 +350,7 @@ CouchDB.session = function(options) {
CouchDB.user_prefix = "org.couchdb.user:";
CouchDB.prepareUserDoc = function(user_doc, new_password) {
- user_doc._id = user_doc._id || CouchDB.user_prefix + user_doc.username;
+ user_doc._id = user_doc._id || CouchDB.user_prefix + user_doc.name;
if (new_password) {
// handle the password crypto
user_doc.salt = CouchDB.newUuids(1)[0];