Learners get email/SMS OTP codes via /user/sendResetCode; team members get reset links via new /team/sendResetCode and /team/resetPassword APIs, with admin panel integration docs. Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
668 B
SQL
16 lines
668 B
SQL
CREATE TABLE IF NOT EXISTS team_otps (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
team_member_id BIGINT NOT NULL REFERENCES team_members(id) ON DELETE CASCADE,
|
|
sent_to VARCHAR(255) NOT NULL,
|
|
medium VARCHAR(50) NOT NULL DEFAULT 'email',
|
|
otp_for VARCHAR(50) NOT NULL DEFAULT 'reset',
|
|
otp VARCHAR(10) NOT NULL,
|
|
used BOOLEAN NOT NULL DEFAULT FALSE,
|
|
used_at TIMESTAMPTZ,
|
|
expires_at TIMESTAMPTZ NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_team_otps_member_id ON team_otps(team_member_id);
|
|
CREATE INDEX IF NOT EXISTS idx_team_otps_member_created ON team_otps(team_member_id, created_at DESC);
|