couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [01/49] git commit: updated refs/heads/1867-feature-plugins to d269b53
Date Fri, 02 Aug 2013 20:08:15 GMT
Updated Branches:
  refs/heads/1867-feature-plugins 95377d9a1 -> d269b53b0 (forced update)


Fauxton Fixes for dev server and auth

* Remove unneeded path in dev server.
* Fix error message for missing password or username
* Only load up RouteObject if auth succeeds


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

Branch: refs/heads/1867-feature-plugins
Commit: 3acb7815a8496d7609dd49938b2bb09d50c6ac34
Parents: 198f936
Author: Garren Smith <garren.smith@gmail.com>
Authored: Mon Jul 29 18:30:21 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Mon Jul 29 18:30:21 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/auth/resources.js |  4 +-
 src/fauxton/app/router.js                | 66 +++++++++++++--------------
 src/fauxton/tasks/couchserver.js         |  4 +-
 3 files changed, 36 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/3acb7815/src/fauxton/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js
index ad7c529..e610951 100644
--- a/src/fauxton/app/addons/auth/resources.js
+++ b/src/fauxton/app/addons/auth/resources.js
@@ -104,7 +104,7 @@ function (app, FauxtonAPI) {
 
     createAdmin: function (username, password, login) {
       var that = this,
-          error_promise =  this.validateUser(username, password, 'Authname or password cannot
be blank.');
+          error_promise =  this.validateUser(username, password, 'Username or password cannot
be blank.');
 
       if (error_promise) { return error_promise; }
 
@@ -123,7 +123,7 @@ function (app, FauxtonAPI) {
     },
 
     login: function (username, password) {
-      var error_promise =  this.validateUser(username, password, 'Authname or password cannot
be blank.');
+      var error_promise =  this.validateUser(username, password, 'Username or password cannot
be blank.');
 
       if (error_promise) { return error_promise; }
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3acb7815/src/fauxton/app/router.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/router.js b/src/fauxton/app/router.js
index de1b7e4..c12d951 100644
--- a/src/fauxton/app/router.js
+++ b/src/fauxton/app/router.js
@@ -11,35 +11,35 @@
 // the License.
 
 define([
-  // Load require for use in nested requiring
-  // as per the note in: http://requirejs.org/docs/api.html#multiversion
-  "require",
+       // Load require for use in nested requiring
+       // as per the note in: http://requirejs.org/docs/api.html#multiversion
+       "require",
 
-  // Application.
-  "app",
+       // Application.
+       "app",
 
-  // Initialize application
-  "initialize",
+       // Initialize application
+       "initialize",
 
-  // Load Fauxton API
-  "api",
+       // Load Fauxton API
+       "api",
 
-  // Modules
-  "modules/fauxton/base",
-  // Layout
-  "modules/fauxton/layout",
+       // Modules
+       "modules/fauxton/base",
+       // Layout
+       "modules/fauxton/layout",
 
-  // Routes return the module that they define routes for
-  "modules/databases/base",
-  "modules/documents/base",
-  "modules/pouchdb/base",
+       // Routes return the module that they define routes for
+       "modules/databases/base",
+       "modules/documents/base",
+       "modules/pouchdb/base",
 
 
-  // this needs to be added as a plugin later
-  // "modules/logs/base",
-  // "modules/config/base",
+       // this needs to be added as a plugin later
+       // "modules/logs/base",
+       // "modules/config/base",
 
-  "load_addons"
+       "load_addons"
 ],
 
 function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents, Pouch,
LoadAddons) {
@@ -53,29 +53,27 @@ function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases,
Documents
     addModuleRouteObject: function(RouteObject) {
       var that = this; //change that to that
       var masterLayout = this.masterLayout,
-          routeUrls = RouteObject.prototype.getRouteUrls();
+      routeUrls = RouteObject.prototype.getRouteUrls();
 
       _.each(routeUrls, function(route) {
         this.route(route, route.toString(), function() {
-          var args = Array.prototype.slice.call(arguments);
-
-          if (!that.activeRouteObject || !that.activeRouteObject.hasRoute(route)) {
-            that.activeRouteObject = new RouteObject(route, masterLayout, args);
-          }
-
-          var routeObject = that.activeRouteObject,
-              roles = routeObject.getRouteRoles(route);
-
-          var authPromise = app.auth.checkAccess(roles);
+          var args = Array.prototype.slice.call(arguments),
+          roles = RouteObject.prototype.getRouteRoles(route),
+          authPromise = app.auth.checkAccess(roles);
 
           authPromise.then(function () {
+            if (!that.activeRouteObject || !that.activeRouteObject.hasRoute(route)) {
+              that.activeRouteObject = new RouteObject(route, masterLayout, args);
+            }
+
+            var routeObject = that.activeRouteObject;
             routeObject.routeCallback(route, args);
             routeObject.renderWith(route, masterLayout, args);
           }, function () {
             FauxtonAPI.auth.authDeniedCb();
-         });
+          });
 
-        });
+        }); 
       }, this);
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3acb7815/src/fauxton/tasks/couchserver.js
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/couchserver.js b/src/fauxton/tasks/couchserver.js
index d9c2a88..679fe57 100644
--- a/src/fauxton/tasks/couchserver.js
+++ b/src/fauxton/tasks/couchserver.js
@@ -51,9 +51,9 @@ module.exports = function (grunt) {
         filePath = path.join('./',req.url);
       } else if (!!url.match(/\.css|img/)) {
         filePath = path.join(dist_dir,req.url);
-      } else if (!!url.match(/\/js\//)) {
+      /*} else if (!!url.match(/\/js\//)) {
         // serve any javascript or files from dist debug dir
-        filePath = path.join(dist_dir,req.url);
+        filePath = path.join(dist_dir,req.url);*/
       } else if (!!url.match(/\.js$|\.html$/)) {
         // server js from app directory
         filePath = path.join(app_dir,req.url.replace('/_utils/fauxton/app',''));


Mime
View raw message