diff --git a/.meteor/packages b/.meteor/packages index 078b988..606ef4d 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -4,7 +4,6 @@ # but you can also edit it by hand. standard-app-packages -insecure coffeescript bootstrap-3 font-awesome diff --git a/client/client.coffee b/client/client.coffee index 48c530b..16ada85 100644 --- a/client/client.coffee +++ b/client/client.coffee @@ -67,8 +67,10 @@ Router.map -> # You can't set a callback for when the user logs in using a cookie so... # Cheap ass work around for routing the user after he logs in with a token Deps.autorun -> - t = Router.current(); return unless t and t.lookupTemplate - if getUser() and t.lookupTemplate() is 'login' then Router.go 'home' + t = Router.current(); return unless getUser() and t and t.lookupTemplate + temp = t.lookupTemplate() + if temp is 'login' or temp is 'homepage' or temp is 'try' + Router.go 'home' # Client Templates @@ -108,6 +110,8 @@ Template.notelist.getDate = -> #day = new Date(@date).toLocaleString().split(' ')[0] Template.notelist.notes = -> d = notes.find({},{ sort: date: 1}).fetch() +Template.notelist.notelist = -> + Template.notelist.events 'click .close-note': -> notes.remove @_id 'keypress #newNote': (e,template) -> diff --git a/client/view/templates.html b/client/view/templates.html index ea2f659..e8d7a6d 100644 --- a/client/view/templates.html +++ b/client/view/templates.html @@ -43,7 +43,7 @@ diff --git a/server/server.coffee b/server/server.coffee index bb8fde2..7661c4c 100644 --- a/server/server.coffee +++ b/server/server.coffee @@ -7,8 +7,8 @@ else console.log "Not Sending Emails, please set the MAIL_URL environment variable" notes = new Meteor.Collection "notes" - getUser = (id) -> Meteor.users.findOne { _id: id } +isUsers = (u,doc) -> u and doc.userId is u # Returns true if the user has verified at least one email address userValidated = (user) -> @@ -23,6 +23,10 @@ Meteor.publish "archive", -> if userValidated getUser(@userId) notes.find userId: @userId, archived: yes +# Database Permissions +# Allow all users to insert, update and remove their notes. +notes.allow insert: isUsers, update: isUsers, remove: isUsers + # Methods that the clients can invoke Meteor.methods resendConfirmEmail: ->