Implement AI workspace and mitigation workflow

This commit is contained in:
2026-02-15 04:27:28 +00:00
parent de2b9a9bbb
commit 2d3b8fdac6
64 changed files with 7669 additions and 769 deletions

View File

@@ -1,16 +1,18 @@
# Create a debug log to confirm script execution
import sys
import django
import os
import sys
import django
LOG_PATH = "auth_debug.log"
def log(data):
with open(LOG_PATH, "a") as f:
f.write(f"{data}\n")
# Set up Django environment
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") # Adjust if needed
django.setup()
@@ -18,11 +20,13 @@ django.setup()
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
def check_credentials(username, password):
"""Authenticate user via Django"""
user = authenticate(username=username, password=password)
return user is not None and user.is_active
def main():
"""Process authentication requests from Prosody"""
while True:
@@ -42,7 +46,9 @@ def main():
continue
command, username, domain = parts[:3]
password = ":".join(parts[3:]) if len(parts) > 3 else None # Reconstruct password
password = (
":".join(parts[3:]) if len(parts) > 3 else None
) # Reconstruct password
if command == "auth":
if password and check_credentials(username, password):
@@ -71,5 +77,6 @@ def main():
log(f"Error: {str(e)}\n")
print("0", flush=True) # Return failure for any error
if __name__ == "__main__":
main()
main()