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

fixed a few bugs

This commit is contained in:
Enrico Fasoli 2015-03-02 16:30:47 +01:00
parent 91c9aac89d
commit 99be3a3723
2 changed files with 13 additions and 7 deletions

View File

@ -66,8 +66,8 @@ loggedInController = RouteController.extend
@render 'loading' @render 'loading'
else @render() else @render()
onBeforeAction: -> onBeforeAction: ->
if not getUser() then Router.redirect 'home' if not getUser() then @redirect 'home'
else if not amIValid() then Router.redirect 'verifyEmail' else if not amIValid() then @redirect 'verifyEmail'
@next() @next()
guestController = RouteController.extend guestController = RouteController.extend
@ -77,18 +77,21 @@ guestController = RouteController.extend
else @render() else @render()
onBeforeAction: -> onBeforeAction: ->
if getUser() if getUser()
if amIValid() is no then Router.redirect 'verifyEmail' else Router.redirect 'notes' if amIValid() is no then @redirect 'verifyEmail' else Router.redirect 'notes'
@next() @next()
# Page Routing # Page Routing
Router.route '/', Router.route '/',
name: 'home' name: 'home'
template: 'homepage' template: 'homepage'
action: -> @render 'homepage', to: 'outside' action: ->
@render 'homepage', to: 'outside'
# Iron Router Workaround for a bug where content from previous renderings carries over if not overwritten
@render 'nothing'
onBeforeAction: -> onBeforeAction: ->
# Dispatch user to the right landing page based on his account status # Dispatch user to the right landing page based on his account status
if getUser() if getUser()
if amIValid() is yes then Router.redirect 'notes' else Router.redirect 'verifyEmail' if amIValid() is yes then @redirect 'notes' else Router.redirect 'verifyEmail'
@next() @next()
Router.route '/login', controller: guestController Router.route '/login', controller: guestController
Router.route '/register', controller: guestController Router.route '/register', controller: guestController
@ -108,7 +111,7 @@ Router.route '/verify/:token?',
onBeforeAction: -> onBeforeAction: ->
if getUser() if getUser()
if amIValid() if amIValid()
Router.redirect 'home' @redirect 'home'
@next() @next()
else if @params.token? and @params.token isnt "" else if @params.token? and @params.token isnt ""
# Automatic verification # Automatic verification
@ -121,7 +124,7 @@ Router.route '/verify/:token?',
Router.go 'home' Router.go 'home'
@next() @next()
else else
Router.redirect 'home' @redirect 'home'
@next() @next()
Router.route '/archive/:_id?', Router.route '/archive/:_id?',
name: 'archive' name: 'archive'

View File

@ -1,5 +1,8 @@
<!-- Homework UI Templates --> <!-- Homework UI Templates -->
<!-- Nothing template -->
<template name="nothing"></template>
<!-- 3 buttons Navigation Menu --> <!-- 3 buttons Navigation Menu -->
<template name="menu"> <template name="menu">
<div align="center" class="menu-container"> <div align="center" class="menu-container">