This app was working fine till I tried to "secure it":
- remove insecure
- remvoe autopublish
- add accounts-ui accounts-password
made some changes to the code as below
//both.js FooterButtons = new Mongo.Collection('footerButtons'); Tasks1 = new Mongo.Collection('tasks1'); Tasks = new Mongo.Collection('tasks'); Tasks1.allow({ insert: function (userId, doc) { return userId; } }); // deny anyone that tries to update the document userId Posts.deny({ update: function (userId, docs, fields, modifier) { // can't change owners return _.contains(fields, 'userId'); } }); //server.js Meteor.publish('tasks', function(){ return Tasks.find({userId: this.userId}); }); Meteor.publish('tasks1', function(){ return Tasks1.find({userId: this.userId}); }); Meteor.publish('footerButtons', function(){ return FooterButtons.find({userId: this.userId}); });
Now the app is crashing with browser saying
/Users/myName/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245 throw(ex); ^ ReferenceError: Posts is not defined at both/both.js:15:1 at both/both.js:20:4 at /Users/myName/Documents/meteor/microscope/.meteor/local/build/programs/server/boot.js:242:10 at Array.forEach (native) at Function..each..forEach (/Users/empl1/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11) at /Users/myName/Documents/meteor/microscope/.meteor/local/build/programs/server/boot.js:137:5 Exited with code: 8 Your application is crashing. Waiting for file change.
Why is it crashing and how should it be fixed? Thanks