This commit is contained in:
parent
b997c1c530
commit
6f23d5b904
@ -31,11 +31,11 @@ export default (router, tpl) => {
|
|||||||
return res.reply({ body: "user doesn't exist or wrong password" });
|
return res.reply({ body: "user doesn't exist or wrong password" });
|
||||||
const stamp = ~~(Date.now() / 1e3);
|
const stamp = ~~(Date.now() / 1e3);
|
||||||
|
|
||||||
await db`
|
/*await db`
|
||||||
delete from user_sessions
|
delete from user_sessions
|
||||||
where last_action <= ${(Date.now() - 6048e5)}
|
where last_used <= ${(Date.now() - 6048e5)}
|
||||||
and kmsi = 0
|
and kmsi = 0
|
||||||
`;
|
`;*/
|
||||||
|
|
||||||
const session = lib.md5(lib.createID());
|
const session = lib.md5(lib.createID());
|
||||||
const blah = {
|
const blah = {
|
||||||
@ -44,13 +44,12 @@ export default (router, tpl) => {
|
|||||||
browser: req.headers["user-agent"],
|
browser: req.headers["user-agent"],
|
||||||
created_at: stamp,
|
created_at: stamp,
|
||||||
last_used: stamp,
|
last_used: stamp,
|
||||||
last_action: "/login",
|
|
||||||
kmsi: typeof req.post.kmsi !== 'undefined' ? 1 : 0
|
kmsi: typeof req.post.kmsi !== 'undefined' ? 1 : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
await db`
|
await db`
|
||||||
insert into "user_sessions" ${
|
insert into "user_sessions" ${
|
||||||
db(blah, 'user_id', 'session', 'browser', 'created_at', 'last_used', 'last_action', 'kmsi')
|
db(blah, 'user_id', 'session', 'browser', 'created_at', 'last_used', 'kmsi')
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user