feat: implement password reset functionality with token verification and change password feature
This commit is contained in:
@@ -452,5 +452,20 @@ export default function initializeDatabase() {
|
||||
CREATE INDEX IF NOT EXISTS idx_field_history_table_record ON field_change_history(table_name, record_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_field_history_field ON field_change_history(table_name, record_id, field_name);
|
||||
CREATE INDEX IF NOT EXISTS idx_field_history_changed_by ON field_change_history(changed_by);
|
||||
|
||||
-- Password reset tokens table
|
||||
CREATE TABLE IF NOT EXISTS password_reset_tokens (
|
||||
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
|
||||
user_id TEXT NOT NULL,
|
||||
token TEXT UNIQUE NOT NULL,
|
||||
expires_at TEXT NOT NULL,
|
||||
used INTEGER DEFAULT 0,
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Create index for password reset tokens
|
||||
CREATE INDEX IF NOT EXISTS idx_password_reset_token ON password_reset_tokens(token);
|
||||
CREATE INDEX IF NOT EXISTS idx_password_reset_user ON password_reset_tokens(user_id);
|
||||
`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user