fixing issue with auth (removed session saving stuff by mistake)

This commit is contained in:
Julian Lam
2013-04-25 11:04:08 -04:00
parent 3eb4f0e1a2
commit eac3785b29
3 changed files with 27 additions and 16 deletions

View File

@@ -21,7 +21,13 @@ var config = require('../config.js'),
return global.socket.emit('user.login', {'status': 0, 'message': 'Incorrect username / password combination.'});
} else {
// Start, replace, or extend a session
global.uid = uid;
RDB.get('session:' + user.sessionID, function(session) {
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!'});
}