Commit Graph

29 Commits

Author SHA1 Message Date
salvacybersec
e457a37680 assets 2025-11-11 07:15:39 +03:00
salvacybersec
fa7c4fbec0 cors 2025-11-11 07:12:06 +03:00
salvacybersec
9a3f299c0c fix try 2025-11-11 07:04:23 +03:00
salvacybersec
85631931f9 Fix: Move frontendDistPath definition before usage 2025-11-11 06:16:38 +03:00
salvacybersec
859a656032 Fix: Prevent src/public from overriding frontend dist on root path 2025-11-11 06:16:17 +03:00
salvacybersec
431e0a17ed Add debug logging for frontend dist and SPA fallback 2025-11-11 06:15:49 +03:00
salvacybersec
3b021417f9 Fix: Improve static file serving headers for CORS and content types 2025-11-11 06:13:10 +03:00
salvacybersec
ed75f1bd10 Fix: Add trust proxy for reverse proxy and fix asset paths for HTTPS 2025-11-11 06:05:12 +03:00
salvacybersec
b7a8d142db Fix: Relax Helmet CSP for SPA and improve static file serving 2025-11-11 05:58:45 +03:00
salvacybersec
fba0a8469f Add admin user management in settings panel (username and password change) 2025-11-11 05:39:13 +03:00
salvacybersec
3e012be78e Fix: SPA fallback should be after all routes 2025-11-11 05:34:02 +03:00
salvacybersec
36c5b108ed Add single container Docker setup (backend + frontend in one container) 2025-11-11 05:33:46 +03:00
salvacybersec
186d32ad79 Fix: bind to 0.0.0.0 for external access (backend + frontend) 2025-11-11 05:25:10 +03:00
salvacybersec
16f5b39fc6 Add CORS development mode - allow all origins in dev 2025-11-11 05:08:03 +03:00
salvacybersec
686556c7dd cors 2025-11-11 04:58:38 +03:00
salvacybersec
fa6259e0bd Mail scheme updated v2 2025-11-11 04:09:45 +03:00
salvacybersec
06136294da Mail schemes updated auto system 2025-11-11 03:02:11 +03:00
salvacybersec
a8bedc7fbc feat: Significantly improve AI prompt quality for template generation
Enhanced system prompt:
- Professional cyber security expert role
- Modern HTML/CSS styling instructions
- Responsive design requirements
- Persuasive and urgent tone guidance
- Turkish language grammar emphasis
- Realistic corporate email appearance

Enhanced user prompt:
- Better structured input with emojis (📌)
- Clear field labels (HEDEF ŞİRKET, SENARYO, etc.)
- Detailed HTML example with inline CSS
- Button styling, footer, responsive design
- Max 70 char subject line guidance
- Multiple warnings for quality output

All user inputs are sent to AI:
 company_name (Şirket Adı)
 scenario (Senaryo)
 employee_info (Çalışan Bilgisi) - optional
 custom_prompt (Ek Talimatlar) - optional

template_name and template_type are for DB only, NOT sent to AI.

This will produce much higher quality, styled HTML emails.
2025-11-11 02:49:12 +03:00
salvacybersec
69702c4700 fix: Correct database field names in Ollama template creation
The bug was in field mapping when saving AI-generated templates:
- Changed 'type' to 'template_type' (correct column name)
- Changed 'body_template' to 'body_html' (correct column name)

This fixes the 400 Bad Request validation error:
'notNull Violation: MailTemplate.template_type cannot be null'

Now AI template generation works correctly.
2025-11-10 23:45:38 +03:00
salvacybersec
1b3d6f263f fix: Remove unique constraint from template_type and improve AI response handling
Database Changes:
- Remove UNIQUE constraint from mail_templates.template_type
- Allow multiple templates with same type (e.g., multiple bank templates)

Ollama Service Improvements:
- Add detailed logging for AI responses (first 500 chars)
- Check multiple field name variations (subject/Subject/konu/title, body/Body/html/content)
- Improve error messages with actual field names
- Better JSON parsing with fallback
- Clearer prompt instructions to AI

This fixes:
- 400 Validation Error when creating templates with existing type
- AI response parsing issues with different field names
2025-11-10 23:40:46 +03:00
salvacybersec
947d2b521b fix: Add missing logger.js and fix Ollama routes middleware
- Add backend/src/utils/logger.js (Winston logger)
- Fix ollama.routes.js middleware import (requireAuth instead of isAuthenticated)
- Add axios to package.json dependencies
- Create logs directory for Winston
- Fix module paths for Ollama integration

This fixes the backend startup issues after Ollama integration.
2025-11-10 21:19:20 +03:00
salvacybersec
af0510e486 feat: Add Ollama AI integration for automatic mail template generation
 New Features:
- 🤖 AI-powered mail template generation with Ollama
- 📧 Test mail sending with preview
- 🔧 Ollama server and model management
- 🎨 Beautiful AI generation dialog in Templates page
- ⚙️ Ollama settings panel with connection test

Backend:
- Add ollama.service.js - Ollama API integration
- Add ollama.controller.js - Template generation endpoint
- Add ollama.routes.js - /api/ollama/* routes
- Support for multiple Ollama models (llama3.2, mistral, gemma)
- JSON-formatted AI responses with subject + HTML body
- Configurable server URL and model selection

Frontend:
- Settings: Ollama configuration panel
  - Server URL input
  - Model selection
  - Connection test with model listing
- Templates: AI generation dialog
  - Company name, scenario, employee info inputs
  - Custom prompt for AI instructions
  - Auto-save to database
  - Test mail sending functionality

Documentation:
- OLLAMA_SETUP.md - Comprehensive setup guide
- Installation instructions
- Model recommendations
- Usage examples
- Troubleshooting

Tech Stack:
- Ollama API integration (REST)
- Axios HTTP client
- React dialogs with MUI
- Self-hosted AI (privacy-friendly)
- Zero external API dependencies

Example Usage:
  Company: Garanti Bankası
  Scenario: Account security warning
  → AI generates professional phishing test mail in seconds!
2025-11-10 21:13:58 +03:00
salvacybersec
f86cda2978 Domain support 2025-11-10 20:01:41 +03:00
salvacybersec
dea1b874b5 feat: Send actual test email instead of just verifying connection
- testConnection now sends a real test email to the configured Gmail address
- User receives actual email confirmation that setup works
- Email contains success message and system info
2025-11-10 19:31:42 +03:00
salvacybersec
c9ff811cc1 fix: Auto-remove spaces from Gmail App Password
- Google provides App Password with spaces (e.g. 'abcd efgh ijkl mnop')
- Backend now automatically removes all spaces before saving
- Users can paste password directly from Google without manual cleanup
- Also trim gmail_user for safety
2025-11-10 19:27:20 +03:00
salvacybersec
ce31698cc4 fix: Gmail App Password parameter name in settings controller
- Changed gmail_password to gmail_app_password in request body destructuring
- Matches frontend Settings.jsx which sends gmail_app_password
- Backend still stores as 'gmail_password' key in database (for backward compatibility)
2025-11-10 19:24:49 +03:00
salvacybersec
20191eb35d feat: Mail template management UI and API CRUD
- Added full CRUD endpoints for mail templates (create, update, delete, preview)
- Introduced Joi validators for template create/update/preview
- Updated routes/controller to support ID and type lookups
- Built React Templates page with HTML editor, preview, and clipboard helpers
- Added navigation entry and route for /templates
- Enhanced documentation (README, QUICKSTART, KULLANIM, frontend/backend README)
2025-11-10 17:27:19 +03:00
salvacybersec
0e5dffb7fc fix: CORS configuration and update all README files
- Fixed dotenv path in app.js to properly load .env from backend root
- Updated CORS to allow http://localhost:5173 (frontend URL)
- Updated README.md with accurate project statistics (58 files, 6677+ lines)
- Updated backend/README.md - marked as Production Ready
- Updated frontend/README.md with complete feature list
- All systems tested and working (backend + frontend)
2025-11-10 17:09:35 +03:00
salvacybersec
19e551f33b first commit: Complete phishing test management panel with Node.js backend and React frontend 2025-11-10 17:00:40 +03:00