Add a way to reset password (WIP)

This commit is contained in:
Greg Burri 2024-11-06 17:52:16 +01:00
parent ebdcb6a90a
commit 5d343c273f
8 changed files with 265 additions and 12 deletions

View file

@ -16,6 +16,11 @@ CREATE TABLE [User] (
[creation_datetime] TEXT NOT NULL, -- Updated when the validation email is sent.
[validation_token] TEXT, -- If not null then the user has not validated his account yet.
[password_reset_token] TEXT, -- If not null then the user can reset its password.
-- The time when the reset token has been created.
-- Password can only be reset during a certain duration after this time.
[password_reset_datetime] TEXT,
[is_admin] INTEGER NOT NULL DEFAULT FALSE
) STRICT;
@ -67,16 +72,15 @@ CREATE TABLE [RecipeTag] (
[recipe_id] INTEGER NOT NULL,
[tag_id] INTEGER NOT NULL,
UNIQUE([recipe_id], [tag_id]),
FOREIGN KEY([recipe_id]) REFERENCES [Recipe]([id]) ON DELETE CASCADE,
FOREIGN KEY([tag_id]) REFERENCES [Tag]([id]) ON DELETE CASCADE
) STRICT;
CREATE TABLE [Tag] (
[id] INTEGER PRIMARY KEY,
[recipe_tag_id] INTEGER,
[name] TEXT NOT NULL,
FOREIGN KEY([recipe_tag_id]) REFERENCES [RecipeTag]([id]) ON DELETE SET NULL
[name] TEXT NOT NULL
) STRICT;
CREATE UNIQUE INDEX [Tag_name_index] ON [Tag] ([name]);