Store signin data in DB and use random codes

This commit is contained in:
2025-06-22 09:06:33 +03:00
parent 708ca49a35
commit ccbb317189
5 changed files with 95 additions and 82 deletions

View File

@@ -1,4 +1,4 @@
CREATE TABLE Players (
CREATE TABLE IF NOT EXISTS Players (
email TEXT PRIMARY KEY,
username TEXT UNIQUE,
digest BLOB,
@@ -7,3 +7,11 @@ CREATE TABLE Players (
new_pass_code TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS SignedInUsers (
code TEXT PRIMARY KEY,
player TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_used_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (player) REFERENCES Players (email) ON DELETE CASCADE
);