1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-11 00:14:17 +00:00

feat: add support for email verification

This commit is contained in:
Elias Schneider
2026-01-10 23:11:54 +01:00
parent 811e8772b6
commit 7d71191902
53 changed files with 1341 additions and 667 deletions

View File

@@ -0,0 +1,2 @@
DROP TABLE email_verification_tokens;
ALTER TABLE users DROP COLUMN email_verified;

View File

@@ -0,0 +1,21 @@
CREATE TABLE email_verification_tokens
(
id TEXT UUID KEY,
created_at TIMESTAMPTZ NOT NULL,
token TEXT NOT NULL UNIQUE,
expires_at TIMESTAMPTZ NOT NULL,
user_id TEXT NOT NULL,
CONSTRAINT email_verification_tokens_user_id_fkey
FOREIGN KEY (user_id)
REFERENCES users (id)
ON DELETE CASCADE
);
ALTER TABLE users
ADD COLUMN email_verified BOOLEAN NOT NULL DEFAULT FALSE;
UPDATE users
SET email_verified = EXISTS (SELECT 1
FROM app_config_variables
WHERE key = 'emailsVerified'
AND value = 'true');