 
 module.exports.authenticated = (req, res) ->
     res.send 200, isAuthenticated: req.isAuthenticated()
+

        res.redirect '/'


module.exports.resetPassword = (req, res) ->
    key = req.params.key
    newPassword = req.body.password

    User.first (err, user) ->
        if err? then next new Error err
        else if not user?
            err = new Error "No user registered."
            err.status = 400
            err.headers = 'Location': '/register/'
            next err
        else
            if Instance.getResetKey() is req.params.key

                validationErrors = User.validatePassword newPassword
                if validationErrors.length is 0
                    data = password: helpers.cryptPassword(newPassword).hash
                    user.merge data, (err) ->

                        else
                            Instance.resetKey = null
                            passwordKeys.resetKeys (err) ->

                                if err? then next new Error err
                                else
                                    passport.currentUser = null
                                    res.send 204

                else
                    error = new Error validationErrors
                    error.status = 400
                    next error

            else
                error = new Error polyglot.t "reset error invalid key"
                error.status = 400
                next error

