Replace cookies with params because cookies are not cross-domain.
Esse commit está contido em:
@@ -13,7 +13,6 @@ try { o_.merge(global, require('./settings.local')); } catch(e) {}
|
||||
|
||||
//app.set('env', 'development');
|
||||
app.use(require('method-override')());
|
||||
app.use(require('cookie-parser')());
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded());
|
||||
var mw = require('./middleware/im')({
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
var cookie = require('cookie');
|
||||
|
||||
module.exports = function(route, app) {
|
||||
app.get(route+'/', function(req, res) {
|
||||
res.render('chat', {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
var o_ = require('../../utils');
|
||||
|
||||
// Cookie that stores the session ID
|
||||
// Will be set as request.sessionID in `authenticate` and `friends` functions
|
||||
exports.cookie = 'sessionid';
|
||||
|
||||
exports.authenticate = function(request, callback, hub) {
|
||||
// Verify user based on request.
|
||||
// On failure, redirect user to auth form
|
||||
|
||||
var username = request.from;
|
||||
if (!username) {
|
||||
username = 'username' + (++hub.uid);
|
||||
}
|
||||
callback({
|
||||
username: 'username' + (++hub.uid),
|
||||
username: username,
|
||||
displayname: 'John Smith',
|
||||
otherinfo: 'any other relevant key/values'
|
||||
});
|
||||
|
||||
@@ -10,27 +10,7 @@ module.exports = function setupHub(options) {
|
||||
return {hub: store, session: function session(req, res, next) {
|
||||
req.sessionStore = store;
|
||||
|
||||
if(!req.cookies) {
|
||||
next(new Error('session requires cookieParser to work properly'));
|
||||
return;
|
||||
}
|
||||
|
||||
// move "fake" cookies from query or body (for JSONP)
|
||||
if (!(options.authentication.cookie in req.cookies)) {
|
||||
if (req.param(options.authentication.cookie)) {
|
||||
req.cookies[options.authentication.cookie] = req.param(options.authentication.cookie);
|
||||
}
|
||||
}
|
||||
|
||||
// move "fake" cookies from query or body (for JSONP)
|
||||
if (!('callback' in req.cookies)) {
|
||||
if (req.param('callback')) {
|
||||
req.cookies['callback'] = req.param('callback');
|
||||
}
|
||||
}
|
||||
|
||||
req.sessionID = req.cookies[options.authentication.cookie];
|
||||
req.jsonpCallback = req.cookies.callback;
|
||||
req.sessionID = req.param('sessionid');
|
||||
|
||||
if(url.parse(req.url).pathname.substring(0, 5) !== '/app/') {
|
||||
next();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// == Server Configuration ==
|
||||
//
|
||||
// This is the configuration file for the Node.js Ajax IM server. Here, you
|
||||
// can set which ports will be used for the public and internal servers,
|
||||
// as well as other settings such as the session cookie name and expiration.
|
||||
// can set which ports will be used for the public and internal servers.
|
||||
|
||||
// === Host and Port ===
|
||||
//
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário