Skip to content

Commit

Permalink
*fixed auth
Browse files Browse the repository at this point in the history
  • Loading branch information
jspears committed Apr 12, 2012
1 parent e675e7d commit a1612f6
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions examples/login-example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ app.configure(function () {
app.register('.js', jqtpl.express);
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.query());
app.use(express.session({ secret:'big fat secret' }));
app.use(express.methodOverride());
app.use(bobamo.express({mongoose:mongoose, plugin:'passport', authModel:User}, express))
Expand Down
5 changes: 4 additions & 1 deletion plugins/generator/views/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ require.config({
'jquery-editors':'libs/backbone-forms/src/jquery-ui-editors',
'bootstrap':'libs/bootstrap/js',
templates: '../templates',
tpl: '../tpl'
{{each(k,j) pluginManager.pluginNames()}}
${j}:'${baseUrl}${j}',
{{/each}}
tpl: '../tpl',
}

});
Expand Down
7 changes: 4 additions & 3 deletions plugins/passport/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ PassportPlugin.prototype.filters = function () {
res.redirect(this.baseUrl);
}.bind(this));

[this.baseUrl + '/rest/*'].forEach(function (v) {
this.app.all(v, this.ensureAuthenticated.bind(this));
[this.baseUrl + '/rest/*'].concat(this.options.restrict).forEach(function (v) {
if (v)
this.app.all(v, this.ensureAuthenticated.bind(this));
}, this);

PluginApi.prototype.filters.apply(this, arguments);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['Backbone', 'jquery', 'underscore', 'text!tpl/login.html'], function (Backbone, $, _, loginTmpl) {
define(['Backbone', 'jquery', 'underscore', 'text!passport/tpl/login.html'], function (Backbone, $, _, loginTmpl) {

var LoginView = Backbone.View.extend({
el: '#content',
Expand Down
File renamed without changes.
Binary file added plugins/static/public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion plugins/static/public/js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define([
doLogin:function(actions){
console.log('doLogin', arguments);
var self = this;
return require(['views/login/login'], function (View) {
return require(['passport/js/views/login/login'], function (View) {
new View({router:self}).render('/'+(actions ? actions.indexOf('login') > -1 ? '/home' : actions : '/home'));
});
},
Expand Down

0 comments on commit a1612f6

Please sign in to comment.