fix(i18n): use everywhere i18n.getUserLanguage middleware - part 2

This commit is contained in:
Matteo Pagliazzi 2014-05-12 16:56:39 +02:00
parent 9aa118e334
commit 4ac10585bb

View file

@ -7,6 +7,7 @@ var utils = require('../utils');
var nconf = require('nconf');
var User = require('../models/user').model;
var ga = require('./../utils').ga;
var i18n = require('./../i18n');
var api = module.exports;
@ -223,7 +224,7 @@ api.changePassword = function(req, res, next) {
api.setupPassport = function(router) {
router.get('/logout', function(req, res) {
router.get('/logout', i18n.getUserLanguage, function(req, res) {
req.logout();
delete req.session.userId;
res.redirect('/');
@ -236,6 +237,7 @@ api.setupPassport = function(router) {
// redirect the user back to this application at /auth/facebook/callback
router.get('/auth/facebook',
passport.authenticate('facebook'),
i18n.getUserLanguage,
function(req, res){
// The request will be redirected to Facebook for authentication, so this
// function will not be called.
@ -248,6 +250,7 @@ api.setupPassport = function(router) {
// which, in this example, will redirect the user to the home page.
router.get('/auth/facebook/callback',
passport.authenticate('facebook', { failureRedirect: '/login' }),
i18n.getUserLanguage,
function(req, res) {
//res.redirect('/');