implemented optional authentification app and stricter password and user rules.

Also against brute force.
This commit is contained in:
2026-04-01 10:38:29 +02:00
parent f2de165c55
commit 9cc1a22232
21 changed files with 1124 additions and 170 deletions
+19
View File
@@ -0,0 +1,19 @@
from .. import db
class LoginAttempt(db.Model):
__tablename__ = "login_attempts"
id = db.Column(db.Integer, primary_key=True)
ip_address = db.Column(db.String(45), nullable=False)
username = db.Column(db.String(80), nullable=False)
failed_attempts = db.Column(db.Integer, nullable=False, default=0, server_default=db.text("0"))
locked_until = db.Column(db.DateTime)
last_failed_at = db.Column(db.DateTime)
__table_args__ = (
db.UniqueConstraint("ip_address", "username", name="uq_login_attempt_ip_username"),
)
def __repr__(self):
return f"<LoginAttempt {self.ip_address}:{self.username}>"