ajouter des sécurité sur les URL, les Roles, les mdp

This commit is contained in:
cedrick2711
2026-07-20 14:57:12 -04:00
parent 482211e6e0
commit 87a84fd43b
20 changed files with 177 additions and 51 deletions
+9 -2
View File
@@ -2,7 +2,8 @@ from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_wtf.csrf import CSRFProtect
from werkzeug.security import generate_password_hash, check_password_hash
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
# Database and extension initialization
db = SQLAlchemy()
@@ -11,6 +12,12 @@ login_manager.login_view = 'auth.login'
login_manager.login_message_category = 'info'
csrf = CSRFProtect()
# Rate limiter for brute-force protection
limiter = Limiter(
key_func=get_remote_address,
default_limits=["200 per day", "50 per hour"]
)
def hash_password(password):
"""
@@ -36,4 +43,4 @@ def check_password(password_hash, password):
Returns:
bool: True if the password matches the hash, False otherwise.
"""
return check_password_hash(password_hash, password)
return check_password_hash(password_hash, password)