mirror of
https://github.com/fazo96/homework.git
synced 2025-03-31 00:58:38 +02:00
19 lines
570 B
CoffeeScript
19 lines
570 B
CoffeeScript
# Homework - Server Side
|
|
notes = new Meteor.Collection "notes"
|
|
|
|
Accounts.config {
|
|
sendVerificationEmail: true
|
|
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"
|