summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2012-02-13 12:57:13 +0100
committerJan Lehnardt <jan@apache.org>2012-02-13 12:57:13 +0100
commit5c52fda540fbdf2eb65e32f94c7df3e0bdd7fc08 (patch)
treea28e53a77e80a59ee78f735cb42527cbedbfe751
parentdce0c288070cb865f44f03c723a76e3cc9eebe15 (diff)
downloadcouchdb-5c52fda540fbdf2eb65e32f94c7df3e0bdd7fc08.tar.gz
Add artificial delay to admin-creation to work around WebKit
WebKit browsers seem to execute the success callback too fast for CouchDB to complete the _config PUT for creating admins. We'll be waiting for 200ms to let CouchDB catch up.
-rw-r--r--share/www/script/futon.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/share/www/script/futon.js b/share/www/script/futon.js
index e32e14ee0..a82269df3 100644
--- a/share/www/script/futon.js
+++ b/share/www/script/futon.js
@@ -85,19 +85,21 @@ function $$(node) {
if (!validateUsernameAndPassword(data, callback)) return;
$.couch.config({
success : function() {
- doLogin(data.name, data.password, function(errors) {
- if(!$.isEmptyObject(errors)) {
- callback(errors);
- return;
- }
- doSignup(data.name, null, function(errors) {
- if (errors && errors.name && errors.name.indexOf && errors.name.indexOf("taken") == -1) {
+ setTimeout(function() {
+ doLogin(data.name, data.password, function(errors) {
+ if(!$.isEmptyObject(errors)) {
callback(errors);
- } else {
- callback();
+ return;
}
- }, false);
- });
+ doSignup(data.name, null, function(errors) {
+ if (errors && errors.name && errors.name.indexOf && errors.name.indexOf("taken") == -1) {
+ callback(errors);
+ } else {
+ callback();
+ }
+ }, false);
+ });
+ }, 200);
}
}, "admins", data.name, data.password);
}