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

fixed registration bug

This commit is contained in:
fazo96 2014-05-27 16:02:37 +02:00
parent d2d328b3ef
commit bf7c51d4b9
4 changed files with 9 additions and 12 deletions

View File

@ -1,7 +1,6 @@
# Homework - Client Side
notes = new Meteor.Collection "notes"
Deps.autorun -> Meteor.subscribe "my-notes" unless not Meteor.userId()
#Meteor.subscribe "my-notes"
# User Interface
Template.userInfo.events {

View File

@ -65,7 +65,7 @@
</template>
<template name="editor">
{{> notifications }}
<div align="center">{{> notifications }}</div>
{{#if note}}
<div class="panel panel-info">
<div class="panel-heading">

View File

@ -1,6 +1,10 @@
# Homework - Server Side
notes = new Meteor.Collection "notes"
validateEmail = (email) ->
expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/
expr.test email
Accounts.config {
sendVerificationEmail: false
loginExpirationInDays: 1
@ -11,8 +15,7 @@ Meteor.publish "my-notes", ->
# 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"
mail = user.emails[0].address
if Match.test(mail,String) is no or validateEmail(mail) is no
throw new Meteor.Error 403, "Invalid Email"
return yes

View File

@ -1,5 +0,0 @@
# Utility Stuff for Homework
validateEmail = (email) ->
re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
re.test email