Files
ds-chat/backend/alembic/versions/456cd78ca571_password_resets.py
T
ksmith fc96e85014 Add self-service password change, forgot-password flow, and fix admin UI bugs
Users can change their own password from the profile modal, and a
"forgot password" link sends a 15-minute expiring reset link (same
hashed-token pattern as site invites). The forgot-password response is
always generic so it never reveals which emails are registered.

Also fixes two admin-page display bugs found while testing: table row
divider lines that didn't line up across a row (the actions column had
`display: flex` on the <td> itself, breaking it out of normal table-cell
layout -- moved to a child <div>), and the pending-invites list floating
with no visual grouping (now boxed with a label and per-status badges).
2026-08-14 21:06:17 -06:00

46 lines
1.7 KiB
Python

"""password resets
Revision ID: 456cd78ca571
Revises: a3f7c2e91b4d
Create Date: 2026-08-14 20:55:22.055123
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '456cd78ca571'
down_revision: Union[str, Sequence[str], None] = 'a3f7c2e91b4d'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('password_resets',
sa.Column('id', sa.Uuid(), nullable=False),
sa.Column('user_id', sa.Uuid(), nullable=False),
sa.Column('token_hash', sa.String(length=64), nullable=False),
sa.Column('used', sa.Boolean(), nullable=False),
sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_password_resets_token_hash'), 'password_resets', ['token_hash'], unique=True)
op.create_index(op.f('ix_password_resets_user_id'), 'password_resets', ['user_id'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_password_resets_user_id'), table_name='password_resets')
op.drop_index(op.f('ix_password_resets_token_hash'), table_name='password_resets')
op.drop_table('password_resets')
# ### end Alembic commands ###