mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
Saving a different address in Settings starts a change that waits for the new address. A link goes there, and the account keeps its address, and whether it is confirmed, until the link is opened (once, within 24 hours). The current address gets a notice. - Opening the link moves the account, marks the address confirmed, and ends what the account still had out by mail: other confirm and change links, unused reset links and sign-in codes, and the unsubscribe link in reminders sent to the old address. - A waiting address holds nothing. Anyone can still sign up with it, and the link then says the address is taken and changes nothing. - Settings shows the waiting address, with Send again and Cancel change. Limits: three links an hour per inbox, five an hour and ten a day per account, twenty an hour per network address. - Migration 0031 adds purpose to email_verifications. New routes: POST /api/auth/email-change/resend and DELETE /api/auth/email-change. - Deleting an account deletes its email links.
15 lines
995 B
SQL
15 lines
995 B
SQL
-- A new account email takes effect once the new address confirms it (migration 0031).
|
|
--
|
|
-- A change of address is a row in email_verifications (0022), like the link that confirms the
|
|
-- address an account already has, and the same GET /api/auth/verify-email spends it. `purpose`
|
|
-- tells the two apart:
|
|
-- 'confirm' marks the account's current address verified, when it is still the row's `email`;
|
|
-- 'change' moves the account to the row's `email` and marks it verified.
|
|
-- An unused, unexpired 'change' row is all a pending change is. users.email and
|
|
-- users.email_verified stay as they are until its link is opened, so a pending address is not
|
|
-- held: anyone may still sign up with it, and opening the link then changes nothing.
|
|
--
|
|
-- A column, not a table, so there is no new name to check against 0001_init. Rows written before
|
|
-- this migration are confirm links, which is what the default says.
|
|
ALTER TABLE email_verifications ADD COLUMN purpose TEXT NOT NULL DEFAULT 'confirm';
|