1
0
mirror of https://github.com/fazo96/homework.git synced 2025-01-10 12:14:22 +01:00
This commit is contained in:
fazo96 2014-10-01 08:42:06 +02:00
parent 819c56c98e
commit 11cdfa2a22
2 changed files with 8 additions and 5 deletions

View File

@ -52,6 +52,7 @@ loggedInController = RouteController.extend
@render 'loading'
else @render()
onBeforeAction: ->
showError()
if not getUser() then Router.go 'home'
else if not amIValid() then Router.go 'verifyEmail'
@ -61,6 +62,7 @@ guestController = RouteController.extend
@render 'reconnect'
else @render()
onBeforeAction: ->
showError()
if getUser()
if amIValid() is no then Router.go 'verifyEmail' else Router.go 'notes'
@ -231,11 +233,12 @@ Template.notifications.events
# "Error" visualization template
errorDep = new Deps.Dependency; shownError = undefined
showError = (err) ->
shownError = err; shownError.type = err.type or "danger"
if err?
shownError = err; shownError.type = err.type or "danger"
else shownError = undefined
errorDep.changed()
clearError = -> shownError = undefined; errorDep.changed()
Template.error.error = -> errorDep.depend(); shownError
Template.error.events 'click .close': -> clearError()
Template.error.events 'click .close': -> showError()
# Verify Email page
Template.verifyEmail.token = -> Router.current().params.token
@ -243,7 +246,6 @@ Template.verifyEmail.events
'click #btn-verify': (e,template) ->
t = template.find('#token-field').value; t = t.split("/")
t = t[t.length-1] # Remove all the part before the last "/"
console.log "Email ver. using token: "+template.find('#token-field').value
Accounts.verifyEmail t, (err) ->
if err then errCallback err else Router.go 'notes'
'click #btn-resend': ->

View File

@ -56,9 +56,10 @@ Meteor.methods
{$set : { "resume.loginTokens" : [] } }, { multi: yes }
return yes
no
# Allow users to change their date format
Meteor.users.allow
update: (id,doc,fields,mod) ->
if fields[0] == 'dateformat' and fields.length == 1
console.log mod
return yes
return no