 randomstring = require 'randomstring'
 bcrypt = require 'bcrypt'
 fs = require 'fs'
+qs = require 'querystring'
 passport = require 'passport'
 LocalStrategy = require('passport-local').Strategy
 Client = require('request-json').JsonClient

            else
                res.send 404
        else
            res.redirect "/login#{req.url}"

    # Redirect public side of application, redirect request depening on app
    # name.

                port: @defaultPort
                buffer: buffer
        else
            res.redirect "/login#{req.url}?#{qs.stringify(req.query)}"

    # Redirect application, redirect request depening on app name.
    redirectAppAction: (req, res) =>
