summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-04-11 14:48:55 +0200
committerTor Andersson <tor@ccxvii.net>2022-04-15 14:34:52 +0200
commit017f4f89ef9af119caf9961e23c66994e8c3ff90 (patch)
treeae4e9d2282f47e367c4c209e2a99b90d4aa7c1c3
parentf6be31ddf9128b3184dafe313c3e29282a99620d (diff)
downloadserver-017f4f89ef9af119caf9961e23c66994e8c3ff90.tar.gz
Don't log IP addresses.
-rw-r--r--schema.sql3
-rw-r--r--server.js4
2 files changed, 3 insertions, 4 deletions
diff --git a/schema.sql b/schema.sql
index 735fa93..14912d0 100644
--- a/schema.sql
+++ b/schema.sql
@@ -49,8 +49,7 @@ create table if not exists user_last_seen (
primary key
references users
on delete cascade,
- atime timestamp,
- aip text
+ atime timestamp
);
create table if not exists tokens (
diff --git a/server.js b/server.js
index d3de0db..a514bb0 100644
--- a/server.js
+++ b/server.js
@@ -276,7 +276,7 @@ const SQL_UPDATE_USER_NAME = SQL("UPDATE users SET name=? WHERE user_id=?");
const SQL_UPDATE_USER_MAIL = SQL("UPDATE users SET mail=? WHERE user_id=?");
const SQL_UPDATE_USER_ABOUT = SQL("UPDATE users SET about=? WHERE user_id=?");
const SQL_UPDATE_USER_PASSWORD = SQL("UPDATE users SET password=?, salt=? WHERE user_id=?");
-const SQL_UPDATE_USER_LAST_SEEN = SQL("INSERT OR REPLACE INTO user_last_seen (user_id,atime,aip) VALUES (?,datetime('now'),?)");
+const SQL_UPDATE_USER_LAST_SEEN = SQL("INSERT OR REPLACE INTO user_last_seen (user_id,atime) VALUES (?,datetime('now'))");
const SQL_FIND_TOKEN = SQL("SELECT token FROM tokens WHERE user_id=? AND datetime('now') < datetime(time, '+5 minutes')").pluck();
const SQL_CREATE_TOKEN = SQL("INSERT OR REPLACE INTO tokens (user_id,token,time) VALUES (?, lower(hex(randomblob(16))), datetime('now')) RETURNING token").pluck();
@@ -330,7 +330,7 @@ app.use(function (req, res, next) {
if (user_id) {
login_touch(res, sid);
req.user = SQL_SELECT_USER_INFO.get(user_id);
- SQL_UPDATE_USER_LAST_SEEN.run(user_id, ip);
+ SQL_UPDATE_USER_LAST_SEEN.run(user_id);
}
}