-- Outstanding "forgot your password?" links (`password_reset.rs`). -- -- A table of its own rather than more rows in `email_verifications`: that one is -- emptied per principal whenever a confirmation link is (re)sent, and a reset -- link is a stronger credential — it sets the password — so it gets a shorter -- life and must not be spendable as a confirmation, nor the other way round. -- -- Hashed for the reason sessions and verification links are: a copy of this -- database must not be a bag of ways into other people's accounts. Unix seconds, -- like those tables. A row is deleted on use, when a newer link is asked for and -- once expired, so the table is the set of links currently outstanding. CREATE TABLE IF NOT EXISTS password_resets ( token_hash TEXT PRIMARY KEY, principal TEXT NOT NULL, created_at INTEGER NOT NULL, expires_at INTEGER NOT NULL ); CREATE INDEX IF NOT EXISTS password_resets_principal ON password_resets (principal);