mirror of
https://github.com/fazo96/homework.git
synced 2025-01-24 14:24:20 +01:00
fixed registration bug
This commit is contained in:
parent
d2d328b3ef
commit
bf7c51d4b9
@ -1,7 +1,6 @@
|
|||||||
# Homework - Client Side
|
# Homework - Client Side
|
||||||
notes = new Meteor.Collection "notes"
|
notes = new Meteor.Collection "notes"
|
||||||
Deps.autorun -> Meteor.subscribe "my-notes" unless not Meteor.userId()
|
Deps.autorun -> Meteor.subscribe "my-notes" unless not Meteor.userId()
|
||||||
#Meteor.subscribe "my-notes"
|
|
||||||
|
|
||||||
# User Interface
|
# User Interface
|
||||||
Template.userInfo.events {
|
Template.userInfo.events {
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="editor">
|
<template name="editor">
|
||||||
{{> notifications }}
|
<div align="center">{{> notifications }}</div>
|
||||||
{{#if note}}
|
{{#if note}}
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
# Homework - Server Side
|
# Homework - Server Side
|
||||||
notes = new Meteor.Collection "notes"
|
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 {
|
Accounts.config {
|
||||||
sendVerificationEmail: false
|
sendVerificationEmail: false
|
||||||
loginExpirationInDays: 1
|
loginExpirationInDays: 1
|
||||||
@ -11,8 +15,7 @@ Meteor.publish "my-notes", ->
|
|||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
Accounts.validateNewUser (user) ->
|
Accounts.validateNewUser (user) ->
|
||||||
if Match.test(user.email, String) and validateEmail user.email is yes
|
mail = user.emails[0].address
|
||||||
if user.password and Match.test(user.password,String) is yes and user.password.length > 7
|
if Match.test(mail,String) is no or validateEmail(mail) is no
|
||||||
return yes
|
throw new Meteor.Error 403, "Invalid Email"
|
||||||
else throw new Meteor.Error 403, "Invalid Password"
|
return yes
|
||||||
else throw new Meteor.Error 403, "Invalid Email"
|
|
||||||
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user