summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-11-14 13:04:02 +0100
committerTor Andersson <tor@ccxvii.net>2022-11-14 13:04:02 +0100
commit20d905e0fb094f2d5ec15c59b6a0264eb942e0ab (patch)
treea1f94a8c0ca3ca0a8e3b2c28b8ec2c87d1152bb8
parent0aa91b4dc70c0290a6a1e9b94ef1eb0187b06984 (diff)
downloadserver-20d905e0fb094f2d5ec15c59b6a0264eb942e0ab.tar.gz
Log deleted user names.
-rw-r--r--schema.sql12
-rw-r--r--views/delete_account.pug1
2 files changed, 12 insertions, 1 deletions
diff --git a/schema.sql b/schema.sql
index dee4356..0ff0cc2 100644
--- a/schema.sql
+++ b/schema.sql
@@ -425,3 +425,15 @@ create trigger trigger_mark_threads_as_unread2 after update on posts
begin
delete from read_threads where user_id != new.author_id and thread_id = new.thread_id;
end;
+
+create table if not exists deleted_users (
+ user_id integer primary key,
+ name text collate nocase,
+ mail text collate nocase,
+ time real default (julianday())
+);
+
+drop trigger if exists trigger_log_deleted_users;
+create trigger trigger_log_deleted_users before delete on users begin
+ insert into deleted_users (user_id, name, mail) values (old.user_id, old.name, old.mail);
+end;
diff --git a/views/delete_account.pug b/views/delete_account.pug
index 905945c..e16e1b6 100644
--- a/views/delete_account.pug
+++ b/views/delete_account.pug
@@ -25,5 +25,4 @@ html
p.warning WARNING: Deleting your account is permanent!
p All your games and messages will be lost forever.
p
- button(onclick="window.location='/profile'") Cancel
button(type="submit") Delete!