Add login lockout with ntfy alerts and update docs
- Lock accounts for 15 minutes after 5 consecutive failed login attempts - Send urgent ntfy notification when an account is locked - Send high-priority ntfy notification on login attempt against a locked account - Auto-reset lockout on expiry; reset counter on successful login - Add v2.4 migration for failed_login_attempts and locked_until columns - Add ALLOWED_ORIGINS and SECURE_COOKIES to .env.example - Update README: lockout row in security table, new ntfy events Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,13 +7,15 @@ from database import Base
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
username: Mapped[str] = mapped_column(String(64), unique=True, nullable=False, index=True)
|
||||
hashed_password: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
is_admin: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
is_disabled: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
timezone: Mapped[str] = mapped_column(String(64), nullable=False, default='UTC')
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
username: Mapped[str] = mapped_column(String(64), unique=True, nullable=False, index=True)
|
||||
hashed_password: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
is_admin: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
is_disabled: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
timezone: Mapped[str] = mapped_column(String(64), nullable=False, default='UTC')
|
||||
failed_login_attempts: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
locked_until: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class EggCollection(Base):
|
||||
|
||||
Reference in New Issue
Block a user