Permalink
Browse files

Merge branch 'master' of github.com:malixsys/flatiron-parse

  • Loading branch information...
2 parents 20f41d7 + 793cc76 commit c2065d1a50dcaec99df7d5da6946d9c43649a7c4 M Alix committed Dec 13, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 app.coffee
View
@@ -11,7 +11,8 @@ ecstatic = require "ecstatic"
#bliss = require "./lib/view.bliss.plugin.coffee"
jshtml = require path.join(modules, "view.jshtml.plugin.coffee")
parse = require path.join(modules, "parse.plugin.coffee")
-session_helper = require path.join(modules, "session_helper.coffee")
+sessions = require path.join(modules, "session_helper.coffee")
+auths = require path.join(modules, "auth_helper.coffee")
ParamNotSet = (p,n) ->
err = new Error("Environment Variable Not Set Error! Set #{p} or pass it in as the #{n} argument")
@@ -35,7 +36,7 @@ app.use parse.plugin
app.use jshtml.plugin,
dir: "" + __dirname + "/views",
- ext: '.jshtml'
+ ext: '.jshtml' #.jade .bliss
app.http.before.push ecstatic(
root: __dirname+'/assets',
@@ -53,28 +54,28 @@ app.http.before.push (req,res) ->
res.emit 'next'
app.router.get "/", ->
- session_helper.view_locals @req, {}, (options) =>
+ sessions.view_locals @req, {}, (options) =>
app.render @res, 'index', options
app.router.get "/login", ->
- session_helper.view_locals @req,
+ sessions.view_locals @req,
title: "login | aZoo.me"
isLogin: true
, (options) =>
app.render @res, "login", options
app.router.post "/login", ->
- session_helper.login app, @req.body.username, @req.body.password, (err,user) =>
+ auths.login app, @req.body.username, @req.body.password, (err,user) =>
if err
delete @req.session.user
- session_helper.redirect_with_error_number @req, @res, err, "/login"
+ sessions.redirect_with_error_number @req, @res, err, "/login"
else
@req.session.user = user
- session_helper.redirect_with_success_number @req, @res, 0, "/"
+ sessions.redirect_with_success_number @req, @res, 0, "/"
app.router.get "/logout", ->
delete @req.session.user
- session_helper.redirect_with_success_number @req, @res, 0, "/"
+ sessions.redirect_with_success_number @req, @res, 0, "/"
port = process.env.PORT or 3000
host = process.env.IP

0 comments on commit c2065d1

Please sign in to comment.