Comparison

util/session.lua @ 9947:8ebca1240203

util.session: Fix session id not include unauthed forever
author Kim Alvefur <zash@zash.se>
date Wed, 03 Apr 2019 17:20:57 +0200
parent 7181:8af558965da3
child 10110:3fa3872588a8
comparison
equal deleted inserted replaced
9946:ceaca48a7e6d 9947:8ebca1240203
2 local logger = require "util.logger"; 2 local logger = require "util.logger";
3 3
4 local function new_session(typ) 4 local function new_session(typ)
5 local session = { 5 local session = {
6 type = typ .. "_unauthed"; 6 type = typ .. "_unauthed";
7 base_type = typ;
7 }; 8 };
8 return session; 9 return session;
9 end 10 end
10 11
11 local function set_id(session) 12 local function set_id(session)
12 local id = session.type .. tostring(session):match("%x+$"):lower(); 13 local id = session.base_type .. tostring(session):match("%x+$"):lower();
13 session.id = id; 14 session.id = id;
14 return session; 15 return session;
15 end 16 end
16 17
17 local function set_logger(session) 18 local function set_logger(session)