<commit_before>express = require 'express'
router = express.Router()
api = express.Router()
passport = require 'passport'
auth = require '../lib/authentication'
homeController = require '../controllers/home'
userController = require '../controllers/users'
bandsController = require '../controllers/bands'

# "account" page (temp)
api.get '/account', userController.account

# homepage
router.get '/', homeController.index

# this exists out of protected group because we want unauthorized
# users to be able to see band submissions and vote counts
router.get '/bandsNoAuth', bandsController.indexNoAuth

# sign in & out
router.get '/login', userController.login
router.get '/logout', userController.logout

# facebook OAuth
router.get '/auth/facebook', passport.authenticate('facebook',
  scope: ['email', 'user_location']
)
router.get '/auth/facebook/callback', passport.authenticate('facebook',
  failureRedirect: '/login'
), (req, res) ->
  res.redirect req.session.returnTo or '/'

# google OAuth
router.get '/auth/google', passport.authenticate('google',
  scope: 'profile email'
)
router.get '/auth/google/callback', passport.authenticate('google',
  failureRedirect: '/login'
), (req, res) ->
  res.redirect req.session.returnTo or '/'

# twitter OAuth
router.get '/auth/twitter', passport.authenticate('twitter')
router.get '/auth/twitter/callback', passport.authenticate('twitter',
  failureRedirect: '/login'
), (req, res) ->
  res.redirect req.session.returnTo or '/'

api.get '/bands', bandsController.index
api.post '/bands', bandsController.create
api.get '/bands/:id', bandsController.show
api.post '/bands/:id/vote', bandsController.vote
api.put '/bands/:id', bandsController.update
api.delete '/bands/:id', bandsController.delete

module.exports =
  unprotected: router
  protected: api<commit_msg>prevent passport failure redirects from going to view that no longer exists<commit_after>express = require 'express'
router = express.Router()
api = express.Router()
passport = require 'passport'
auth = require '../lib/authentication'
homeController = require '../controllers/home'
userController = require '../controllers/users'
bandsController = require '../controllers/bands'

# "account" page (temp)
api.get '/account', userController.account

# homepage
router.get '/', homeController.index

# this exists out of protected group because we want unauthorized
# users to be able to see band submissions and vote counts
router.get '/bandsNoAuth', bandsController.indexNoAuth

# sign in & out
router.get '/login', userController.login
router.get '/logout', userController.logout

# facebook OAuth
router.get '/auth/facebook', passport.authenticate('facebook',
  scope: ['email', 'user_location']
)
router.get '/auth/facebook/callback', passport.authenticate('facebook',
  failureRedirect: '/'
), (req, res) ->
  res.redirect req.session.returnTo or '/'

# google OAuth
router.get '/auth/google', passport.authenticate('google',
  scope: 'profile email'
)
router.get '/auth/google/callback', passport.authenticate('google',
  failureRedirect: '/'
), (req, res) ->
  res.redirect req.session.returnTo or '/'

# twitter OAuth
router.get '/auth/twitter', passport.authenticate('twitter')
router.get '/auth/twitter/callback', passport.authenticate('twitter',
  failureRedirect: '/'
), (req, res) ->
  res.redirect req.session.returnTo or '/'

api.get '/bands', bandsController.index
api.post '/bands', bandsController.create
api.get '/bands/:id', bandsController.show
api.post '/bands/:id/vote', bandsController.vote
api.put '/bands/:id', bandsController.update
api.delete '/bands/:id', bandsController.delete

module.exports =
  unprotected: router
  protected: api
{'fraction_non_alphanumeric': 0.14685885232526516, 'fraction_numerical': 0.0, 'mean_word_length': 5.0493421052631575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4781454', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1047, 'n_words': 283}