commenting out global.uid setting

v1.18.x
Julian Lam 12 years ago
parent 9e5a7b96b3
commit 3eb4f0e1a2

@ -14,7 +14,7 @@ global.configuration = {};
global.modules = modules; global.modules = modules;
// change this to = null when auth module is complete // change this to = null when auth module is complete
global.uid = 1; // global.uid = 1;

@ -21,13 +21,7 @@ var config = require('../config.js'),
return global.socket.emit('user.login', {'status': 0, 'message': 'Incorrect username / password combination.'}); return global.socket.emit('user.login', {'status': 0, 'message': 'Incorrect username / password combination.'});
} else { } else {
// Start, replace, or extend a session // Start, replace, or extend a session
RDB.get('session:' + user.sessionID, function(session) { global.uid = uid;
if (session !== user.sessionID) {
RDB.set('session:' + user.sessionID, uid, 60*60*24*14); // Login valid for two weeks
} else {
RDB.expire('session:' + user.sessionID, 60*60*24*14); // Defer expiration to two weeks from now
}
});
return global.socket.emit('user.login', {'status': 1, 'message': 'Logged in!'}); return global.socket.emit('user.login', {'status': 1, 'message': 'Logged in!'});
} }

@ -24,7 +24,7 @@ var express = require('express'),
// Include this middleware if the endpoint requires a logged in user to view // Include this middleware if the endpoint requires a logged in user to view
console.log('REQUIRE: ', global.uid, req.sessionID); console.log('REQUIRE: ', global.uid, req.sessionID);
if (!global.uid) { if (!global.uid) {
req.redirect('/403'); res.redirect('/403');
} else { } else {
next(); next();
} }

Loading…
Cancel
Save