05/02/2026 updated code for security 2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy.dialects.mysql import INTEGER
|
||||
|
||||
@@ -21,7 +21,7 @@ class AuditLog(db.Model):
|
||||
resource_id = db.Column(INTEGER(unsigned=True), nullable=True) # FK to the affected row
|
||||
detail = db.Column(db.String(512), nullable=True) # human-readable summary (no secrets)
|
||||
ip_address = db.Column(db.String(45), nullable=True) # IPv4 or IPv6
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow, nullable=False, index=True)
|
||||
created_at = db.Column(db.DateTime, default=lambda: datetime.now(timezone.utc).replace(tzinfo=None), nullable=False, index=True)
|
||||
|
||||
@classmethod
|
||||
def log(cls, user_id: int, action: str, resource_type: str,
|
||||
|
||||
Reference in New Issue
Block a user