1
0
mirror of https://github.com/fazo96/homework.git synced 2025-01-10 12:14:22 +01:00
homework/server/server.coffee

19 lines
571 B
CoffeeScript
Raw Normal View History

# Homework - Server Side
notes = new Meteor.Collection "notes"
Accounts.config {
2014-05-27 15:34:25 +02:00
sendVerificationEmail: false
loginExpirationInDays: 1
}
Meteor.publish "my-notes", ->
notes.find( { userId: @userId } ) unless not @userId
# Authentication
Accounts.validateNewUser (user) ->
if Match.test(user.email, String) and validateEmail user.email is yes
if user.password and Match.test(user.password,String) is yes and user.password.length > 7
return yes
else throw new Meteor.Error 403, "Invalid Password"
else throw new Meteor.Error 403, "Invalid Email"