mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
* Update user and login security configs * Optimize some code definitions * Update config comments * Update the captcha check * Update the config plugin sql scripts * Add user password history model to init * Fix some logic errors * Add last_password_changed_time to user sql * Fix user update password * Fix the dynamic config check * Update the user sql style
25 lines
735 B
Python
25 lines
735 B
Python
from datetime import datetime
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from backend.common.model import DataClassBase, TimeZone, id_key
|
|
from backend.utils.timezone import timezone
|
|
|
|
|
|
class UserPasswordHistory(DataClassBase):
|
|
"""用户密码历史记录表"""
|
|
|
|
__tablename__ = 'sys_user_password_history'
|
|
|
|
id: Mapped[id_key] = mapped_column(init=False)
|
|
user_id: Mapped[int] = mapped_column(sa.BigInteger, index=True, comment='用户 ID')
|
|
password: Mapped[str] = mapped_column(sa.String(256), comment='历史密码')
|
|
created_time: Mapped[datetime] = mapped_column(
|
|
TimeZone,
|
|
init=False,
|
|
default_factory=timezone.now,
|
|
comment='创建时间',
|
|
)
|