Change login sessions

This commit is contained in:
calzoneman 2015-02-15 21:56:00 -06:00
parent b579db5310
commit 08a9eae2d3
1 changed files with 4 additions and 3 deletions

View File

@ -1,10 +1,10 @@
var sio = require("socket.io"); var sio = require("socket.io");
var cookieParser = require("cookie-parser")();
var Logger = require("../logger"); var Logger = require("../logger");
var db = require("../database"); var db = require("../database");
var User = require("../user"); var User = require("../user");
var Server = require("../server"); var Server = require("../server");
var Config = require("../config"); var Config = require("../config");
var cookieParser = require("cookie-parser")(Config.get("http.cookie-secret"));
var $util = require("../utilities"); var $util = require("../utilities");
var Flags = require("../flags"); var Flags = require("../flags");
var Account = require("../account"); var Account = require("../account");
@ -13,6 +13,7 @@ var net = require("net");
var util = require("../utilities"); var util = require("../utilities");
var crypto = require("crypto"); var crypto = require("crypto");
var isTorExit = require("../tor").isTorExit; var isTorExit = require("../tor").isTorExit;
var session = require("../session");
var CONNECT_RATE = { var CONNECT_RATE = {
burst: 5, burst: 5,
@ -32,8 +33,8 @@ function handleAuth(socket, accept) {
socket.user = false; socket.user = false;
if (data.headers.cookie) { if (data.headers.cookie) {
cookieParser(data, null, function () { cookieParser(data, null, function () {
var auth = data.cookies.auth; var auth = data.signedCookies.auth;
db.users.verifyAuth(auth, function (err, user) { session.verifySession(auth, function (err, user) {
if (!err) { if (!err) {
socket.user = { socket.user = {
name: user.name, name: user.name,