Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Local Strategy for Towerjs
localStrategy: (options) ->
app = Tower.Application.instance()
app.get "/logout", (request, response) ->
request.logout()
response.redirect "/"
app.post "/login", (request, response, next) ->
console.log 'authenticating....'
passport.authenticate("local", (err, user, info) ->
return next(err) if err
unless user
return response.redirect("/")
request.logIn user, (err) ->
return next(err) if err
response.json
email: request.user.email
)(request, response, next)
try
Strategy = require("passport-local").Strategy
passport.use new Strategy (username, password, done) ->
console.log username
App.User.where(name: username).first (err, user) ->
done(err) if err
console.log user
done null, user
catch error
error.message += " (#{name})"
throw error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.