summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/db/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/db/models.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/db/models.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/db/models.py b/packages/meshbay-hub/src/meshbay_hub/db/models.py
index b052e00..f1fff41 100644
--- a/packages/meshbay-hub/src/meshbay_hub/db/models.py
+++ b/packages/meshbay-hub/src/meshbay_hub/db/models.py
@@ -330,6 +330,22 @@ class MailQuota(Base):
last_sent: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
+class LoginThrottle(Base):
+ """Wrong passphrases per username, for the sign-in lockout (`login_throttle.py`).
+
+ Keyed by a hash of the name as typed rather than by account, so an unknown
+ name is counted — and locked — exactly like a real one (M1), and so a
+ passphrase typed into the username field is never stored. Rows age out with
+ the lockout window and are purged by the cleanup task.
+ """
+
+ __tablename__ = "login_throttle"
+
+ key: Mapped[str] = mapped_column(String(64), primary_key=True)
+ failures: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
+ last_failure_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
+
+
class HubSetting(Base):
"""
Instance-wide settings an admin changes at runtime from the panel.