You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/07/29 18:31:44 UTC
git commit: updated refs/heads/master to 3acb781
Updated Branches:
refs/heads/master 198f93657 -> 3acb7815a
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/master
Commit: 3acb7815a8496d7609dd49938b2bb09d50c6ac34
Parents: 198f936
Author: Garren Smith <ga...@gmail.com>
Authored: Mon Jul 29 18:30:21 2013 +0200
Committer: Garren Smith <ga...@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',''));